boilerplate-frontend 0

CP+B Frontend boilerplate

[remove]

Initial Setup

This set up is for static sites and not initailly set up to handle dynamic sites. It can be retro fitted to make that happen, but it is not the case now.

  • Update project name in /README.md
  • Update project name in /package.json

[/remove]

[Project Name]

[ADD SHORT DISCRIPTION OF PROJECT]

Requirements

  • node.js 5.3.0
  • grunt
    • grunt-cli version: 0.1.13
    • grunt version: 0.4.5
  • bower
    • bower version: 1.7.2

Prerequisite

  • npm install -g grunt-cli
  • npm install -g bower
  • npm install -g lodash
  • npm install -g lodash-cli

Quick Start

  • run npm install (you may need to do sudo npm install due to the execSync module)
  • run grunt serve while developing (see below for info on grunt serve)

Development Notes

A few quick reminders as you are developing.

  • ALL CODE CHANGES HAPPEN IN SOURCE, DO NOT ADD ANY FILES DIRECTLY TO DIST
  • Use bower for all libraries accessible via git. Using grunt bowercopy:dev or grunt bowercopy:dist will move those libraries’ assets to the correct location.
  • bower_components is an import path for SASS/Compass.
  • Boilerplate contains Lodash and not Underscore or Lodash version of Underscore, so all Lodash methods are available when required.
  • Accessibility checklist.
  • HTML5 Elements on MDN
  • Custom Tiles in IE11 on MSDN, covers the use of browserconfig.xml in customizing the display of a pinned site in IE11/Win8+

Modernizr

Boilerplate has a custom builder of Modernizr that will allow you to add your own tests. Please update Gruntconfig.js with tests that are needed instead of loading the whole development version. See https://github.com/Modernizr/grunt-modernizr for more settings.

This approach will limit the Modernizr tests to only those needed for the project. As a benefit we prevent running every Modernizr test on every page load of the site.

BrowserSync

BroswerSync.io is included as a grunt task to serve up the site, update it when changes are made, and assist in testing. It includes an additional UI with different toggles for testing. The URL for the UI is printed with the development URL when grunt serve is initially run.

Grunt Tasks

All :dev grunt tasks are for local development and all :dist are used for distribution builds.

  • grunt serve - Will set up everything for local development including live reload
  • grunt dist - Will compile the entired codebase for dev, stg, prod, or deliverable
  • grunt bowercopy - Moves files installed via bower install to their correct locations
    • grunt bowercopy:dev
    • grunt bowercopy:dist
  • grunt browserSync:dev - Serves up static files and displays local and external address
  • grunt clean - Cleans up the .tmp and dist folders
    • grunt clean:dev
    • grunt clean:dist
  • grunt sass - Compiles Sass files tp .tmp/css. Sets import path to include bower_components
    • grunt sass:dev
    • grunt sass:dist
  • grunt concat*
  • grunt concurrent - Runs multiple grunt tasks at the same time to speed up builds
    • grunt concurrent:dev - Fires off nothing atm
    • grunt concurrent:dist - Fires off imagemin:dist, svgmin:dist, cssmin:dist, htmlmin:dist
  • grunt copy - Copies all needed files to correct locations
    • grunt copy:dev
    • grunt copy:dist - copies over robots.txt and favicon.ico to the dist folder
  • grunt htmlmin:dist - Minifies html files from source and saves to dist
  • grunt imagemin:dist - Minifies gif, jpeg, jpg, and png from source and saves to dist
  • grunt jscs - Checks all JavaScript to ensure it all matches standards set in the .jscs.json file
  • grunt jshint - Checks all JavaScript to ensure code quality
  • grunt lodash - Builds a custom lodash file based on
  • grunt modernizr - Builds out a lean version of Modernizr based on the settings found in Gruntconfig.js
    • grunt modernizr:dev - Compiles modernizr based on the Gruntconfig.js
    • grunt modernizr:dist - Compiles modernizr based on the Gruntconfig.js but uglified
  • grunt requirejs - Runs through all JavaScript files and merges all dependencies to a single file. As the project grows, modules should be created to lesson the chances of have large JavaScript files
  • grunt svgmin:dist - Minifies svg from source and saves to dist
  • grunt usebanner - adds a banner to the top of each file that is created*
    • grunt usebanner:distjs - adds a banner to JavaScript files
    • grunt usebanner:distcss - adds a banner to CSS files
    • grunt usebanner:disthtml - adds a banner to HTML files

* Not implimented in Gruntfile.js


License

GNU General Public License Version 3

Related Repositories

frontend-boilerplate

frontend-boilerplate

webpack-react-redux-babel-autoprefixer-hmr-postcss-css-modules-rucksack-boilerplate (unmaintained, I don't use it anymore) ...

gulp-frontend-boilerplate

gulp-frontend-boilerplate

An ES6 boilerplate with common frontend tasks using Gulp 4 as build system. ...

grunt-frontend-boilerplate

grunt-frontend-boilerplate

Simple Grunt boilerplate for frontend workflow ...

frontend-boilerplate

frontend-boilerplate

Frontend boilerplate for modern day web applications (update: not that modern anymore, go use React instead) ...

webapp-boilerplate

webapp-boilerplate

Boilerplate for web applications with a Node, Express, MongoDB backend and Backbone Marionette, Jade, Require.js frontend ...


Top Contributors

bmsterling tsvensen gcpantazis justinhillsjohnson jamesearl brandonminch talentedmrjones kengoldfarb rtgibbons annaocd