syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me

Question:
Ubuntu How to: Lineman Angular Coffee?

When I work on AngularJS projects, I usually start by cloning a template from Github:

lineman_angular_install

After I setup that template, in folder /tmp/latapp/ I should be able to see something like this:


Once I see that page, I am confident that I have installed a Lineman Angular Template on my Ubuntu host.

The next step for me is to mix this template with coffeescript.

I enhance this file:
/tmp/latapp/config/application.js
I place this syntax in application.js:
// /tmp/latapp/config/application.js

module.exports = function(lineman) {
  return {
    server: {
      pushState: true
    },
    concat_sourcemap: {
      js: {
        src: [
          "<%= files.js.vendor %>",
          "<%= files.coffee.generated %>",
          "<%= files.js.app %>",
          "<%= files.ngtemplates.dest %>"
        ]
      }
    }
  };
};
After I verify that the app still behaves, I install a module named js2coffee which is useful for transforming a JavaScript file into a CoffeeScript file:
npm i -g js2coffee
Next, I convert one of the JavaScript files into a CoffeeScript file:
cd /tmp/latapp/app/js/
js2coffee router.js > router.coffee
mv router.js /tmp/
Again, I verify that the app still behaves.

If the app behaves well I am then convinced that I can use coffeescript instead of JavaScript in my new Lineman-Angular app.


syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me