A new AngularJS project seed
A few months ago I started working on a project seed for AngularJS
A project seed is the initial skeleton a developer would use to get things up and running quickly when commencing a new project. There are plenty of these around with the most popular being Yeoman with the Angular generator.
So why another one you would ask? Simply because I preferred to use my own conventions and my preferred tools. And also because of a bit of NIH syndrome too.
Some of the my first requirements were using Gulp as a task runner, just because it’s so much easier to write than Grunt. Next up was using Bower for front-end asset management and Sass for styles. Bower is a proven package manager that is easy to use and Sass needs no introduction.
Down the path it became obvious that I was going to need a few optimizations in place in order to build great performing Angular apps.
templateCache is a great improvement over having every single view sent via XHR on demand.
It basically concatenates all of the views and loads them all at once when the app starts.
ng-annotate does the automatic annotation of the app source (for Dependency Injection), which then can be minified with mangling of the symbols. This greatly reduces file size.
localStorage.debug is a special flag which is set in the browser by the developer. This is read when the app starts and turns on
$log.debug statements and Angular debug classes. These classes are used by tools such as ng-inspector, but otherwise they would unnecesarily pollute the DOM of the app.
Other things which I managed to squeeze in are: hinting of JS files with a friendly output, livereload support, configuring the Gulp task runner via
gulpconfig.json. This enables things such as turning the integrated http server on or off.
The project can be found on Github and your contribution is more than welcome. This is pretty much still a work in progress and support for things like ES6 will be included in the future.
What I do not plan on including for now is a full blown generator. My aim is to keep the code simple and lean.