Structural framework for building static websites
This is a structural framework to get started with, which provide some best practices, library files, grunt task setups. This is based on Node and ruby(SASS engine). This framework is to create static/dynamic HTML files.
- Provides setup for HTML projects
- Some standard css(bootstrap grid, reset) javascript(jquery) library included.
- Based on modular approach for javascript
- SASS - You need to have ruby and compass installed in your machine with global path setup.
- Use Ruby 1.9 for avoiding glitches in using compass.
Unpack the code in your favorite location. Preferably in projects folder. If you have node and sass already installed, then in your command line goto the project directory and run :
npm installgem install compassgrunt server"grunt server" command will automatically open the browser and now you can access your server files in the browser with http://localhost:3100 . The default port no is set as 3100, which you can modify in your site-config file.
Download and install node in your system
For SASS you need to install ruby. For the current setup we recomend using 1.9.1 and for compiling SASS we are using compass which can be installed with the following command
gem install compassFolder structure:
builds : Autometically generated on grunt command
node_modules : Contains node modules. Ignore this folder ( even in your editor preferences)
public : All Javascript, CSS, images, content-images goes here
|- css : folder for generated CSS files
|- min : Minified css to be kept here
|- js : Javascript folder
|- libs : Put all third party javascripts here( un minified)
|- min : Folder for minified js files
|- components : contains components
|- modules : Add your modules if you really need any page/story specific code
|- content-images : Images that are expected to be author contributable( if you are using any CMS)
|- images : All images that are either used in CSS or system images.
|- font : Any custom font
|- services : Put all json/xml/html files requested by ajax calls.
Resources
|- scss : SASS/LESS files.
|- components : contains default styling and customized components
|- global-partials : contains icons, CSS for constants and mixins
|- libs : contains CSS provided by bootstrap and staticframe. Any other CSS libraries used can be placed here.
|- modules : CSS for different modules of the website. Sample Provided.
|- themes : The theme for the website has to be included here
|- sprite-source : sprite psd files
|- ts : If you are using typescript, add your code here in the same structure as that of js in public folder
core
|- routes : Contains routing of pages. Edit it if required.
views : Put your html templates here.
|-components : Contains markup for components of website.
|-global-components : Contains markup for global components of website.
site-config.js : Edit the site related global parameters
config.rb : SASS- compass configuration file
package.json : node modules configuration
app.js : Node root file to start the server.
- CSS grid framework : Bootstrap 3.3.3
- CSS preporocessor : SCSS
- SCSS watcher : Compass
- JS DOM manupulation : jQuery
- JS form validation : jQuery validator
- To install new node module : npm install
- Run grunt task : grunt
- compile scss files : compass watch
- run the application server : node app
- validate user credentials : sudo chown -R $(whoami) ~/.npm
A grunt file is provided with basic set of automation work. Modify it according to your need.
The default setup provides the following functionality:
Default Actions :: Start Server and watch for modifications
$gruntStart Server, watch for modifications and open localhost in default browser
$grunt serverReport :: Generate JSHINT Report and open dev-jshint-report.html
$grunt report-jsBuild :: Uglification of Javascript, css minification, jshint error reporting for your dev environment
$grunt buildMinification :: Uglification of Javascript and CSS minification only
$grunt minify