A Yeoman generator that creates a basic site template with grunt setup ready for development and distribution.
- Grunt setup for sass and distribution
- Sass project scafolding. As minimal as possible.
- jQuery & Modernizer (using Bower package manager) so you can get working straight way.
- index.html so you can start building your site template asap.
Yeoman, Grunt & Bower (Best buddies!)
Not every new computer comes with a Yeoman pre-installed. He lives in the npm package repository. You only have to ask for him once, then he packs up and moves into your hard drive. Make sure you clean up, he likes new and shiny things. If you'd like to get to know Yeoman better and meet some of his friends, Grunt and Bower, check out the complete Getting Started Guide.
Installing the start-site generator requirements
Some of the following code may need a 'sudo' before it to work depending on your setup.
gem install sass
Install Node.js from http://nodejs.org/
- If you get some errors after this it might be that your node packages are out of date.
#Try this if you get some package errors npm cache clean #Followed by npm update
npm install -g bower
Install the Grunt CLI (Command line interface)
npm install -g grunt-cli
npm install -g yo
##Install the generator
(See above for all the )
To install generator-start-site, run:
npm install -g generator-start-site #Lots of code will happen... This is npm installing what it needs
When you want to create a new site simply run:
Answer the questions and Yeoman will sort you out!
Grunt lives in the tasks folder. Navigate to this folder and run (Stop grunt watch running using cmd + c):
#ignore this if your in the 'tasks' folder already cd /yourproject/tasks/ #run grunt watch
Your HTML templates and css/scss live in the dev folder. Any changes you make to the 'dev/src/scss' files will be compiled into the 'dev/static/css' folder. you can make as many HTML file as you need in the dev folder - they will all be copied to the dist folder when you're ready to go live!
Once your site is ready to go live you will need to run:
#ignore this if your in the 'tasks' folder already cd /yourproject/tasks/ #run grunt dist
Grunt will process all your sass, minify and copy it, concatonate and minify your js to the header and footer scripts (pre & post) and copy and html files across to the dist folder. You can the FTP or copy your dist folder to where ever you want. It's all self contained.
In the included index.html you will see:
<!-- build:js static/js/pre.js --> <script src="static/js/header.js"></script> <script src="bower_components/modernizr/modernizr.js"></script> <!-- endbuild -->