An angular seed for medium to large web applications. The base was generated using the yeoman angular generator.
The purpose of this seed is to make it easy to start of angular projects in a proper workflow.
In case you want to use this workflow or distibute it to colleagues follow the following steps.
These are dependencies of which you probably already have most installed.
- Node, Git and Ruby installed
- $ npm install -g grunt-cli && npm install -g bower
- $ (gem install sass) && gem install compass
When you have successfully installed the prerequisits.
- (optionally fork first) Clone repo && cd into folder
- $ npm install && bower install
- grunt serve
- start coding
To setup this repo I went through the following steps
Before you start make sure your username does not contain accented latin characters.
- Node installed
- Git installed
- $ npm install -g grunt-cli
- $ npm install -g yo
- $ npm install -g bower
- Ruby installed
- $ gem install sass If any problems with a certificate download the gem via http. Set the source to try on http if https fails by the following command
- $ gem sources --add http://rubygems.org
- $ gem install compass
- $ npm install -g generator-angular
- $ mkdir <folderName> && cd $_
- $ yo angular <appName>
- Sass? Y
- Twitter Bootstrap? n
- Choose Angular modules
- $ bower install bootstrap-css-only --save
- $ bower install font-awesome --save
- Check or folders are created
- Check or basic grunt commands run
- $ grunt
- $ grunt test
- Run the grunt server ( $ grunt serve )
- $ bower install font-awesome --save
- Installing angular bootstrap
- $ bower install angular-bootstrap --save
- if you have any problems just go to http://angular-ui.github.io/bootstrap/ and download it from there
- $ npm install grunt-remove-logging --save-dev --save-dev saves it as a development dependency
Compass is a great library but the compilation it does within grunt is very slow. With the original setup it took about 4.7 seconds before livereload was triggered by the browser after compiling sass to css. After going through the following steps the reload triggers in under 20ms.
- Create a concurrent task to do the watch see Gruntfile.js at the concurrent.watch task. Be sure to set enable logging as in the example
- Update Compass.watch to set option 'watch' to true. This enables the native Compass watch function
- Add the concurrent.server to the serve task.
To make this repo fit as a seed for medium to large scale apps I decided to make more changes. If you just want to get started with Yeoman and Angular your journey ends here. I you want to use this seed project as is you can follow the instructions in the 'Distributing Workflow' section. I have implemented the following changes:
- Restructured the app after the component-grouped paradigm
- Updating all the grunt tasks to work again
- setting up new structure
- watching for file changes
- compiling sass
- unit tests
- copy templates to distribution folder
- cleaning up old files and paths
- css does not get minified and copied from the
- fixing javascript minification
- filerev css files
- minify all views
- distribution
- Task cdn-ify stopped working.
- test if the project can be served from the dist folder
- Switched to ui-router:
- $ bower uninstall angular-router --save
- $ bower install ui-router --save
- rewrote the router code
- research or templates could be concatenated as well as now each template is an http request