Skip to content

Commit

Permalink
bower/grunt build system for static assets
Browse files Browse the repository at this point in the history
  • Loading branch information
dryan committed Jun 7, 2014
1 parent 9e75360 commit aa78ea1
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
_site/
node_modules/
bower_components/
.sass-cache/
75 changes: 75 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension

{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.


// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.

"node" : false,
"rhino" : false,
"couch" : false,
"wsh" : true, // Windows Scripting Host.

"jquery" : true,
"ender" : true,
"prototypejs" : false,
"mootools" : false,
"dojo" : false,

"predef" : [ // Custom globals.
//"exampleVar",
//"anotherCoolGlobal",
//"iLoveDouglas"
],


// Development.
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
"devel" : true, // Allow developments statements e.g. `console.log();`.


// ECMAScript 5.
"es5" : true, // Allow ECMAScript 5 syntax.
"strict" : false, // Require `use strict` pragma in every file.
"globalstrict" : false, // Allow global "use strict" (also enables 'strict').


// The Good Parts.
"asi" : true, // Tolerate Automatic Semicolon Insertion (no semicolons).
"laxbreak" : true, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
"bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"curly" : true, // Require {} for every new block or scope.
"eqeqeq" : true, // Require triple equals i.e. `===`.
"eqnull" : false, // Tolerate use of `== null`.
"evil" : false, // Tolerate use of `eval`.
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef" : true, // Prohipit variable use before definition.
"loopfunc" : false, // Allow functions to be defined within loops.
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"regexp" : true, // Prohibit `.` and `[^...]` in regular expressions.
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
"scripturl" : true, // Tolerate script-targeted URLs.
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
"undef" : true, // Require all non-global variables be declared before they are used.


// Personal styling preferences.
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
"noempty" : true, // Prohibit use of empty blocks.
"nonew" : true, // Prohibit use of constructors for side-effects.
"nomen" : true, // Prohibit use of initial or trailing underbars in names.
"onevar" : false, // Allow only one `var` statement per function.
"plusplus" : false, // Prohibit use of `++` & `--`.
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
"trailing" : true, // Prohibit trailing whitespaces.
"white" : false, // Check against strict whitespace and indentation rules.
"indent" : 2 // Specify indentation spacing
}
74 changes: 74 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
files: {
'css/screen.css': 'sass/screen.scss'
}
},
options: {
loadPath: [
'bower_components/bourbon/dist',
'bower_components/bootstrap-sass-official/vendor/assets/stylesheets'
],
sourcemap: true,
style: 'compressed',
banner: '/*! <%= pkg.name %> <%= pkg.version %> | <%= pkg.license %> | <%= pkg.homepage %> */'
}
},
jshint: {
files: [
'Gruntfile.js'
],
jshintrc: '.jshintrc'
},
uglify: {
options: {
sourceMap: true,
banner: '/*! <%= pkg.name %> <%= pkg.version %> | <%= pkg.license %> | <%= pkg.homepage %> */'
},
dist: {
files: {
'js/core.min.js': ['js/core.js']
}
}
},
watch: {
css: {
files: 'sass/*.scss',
tasks: ['sass']
},
js: {
files: [
'Gruntfile.js'
],
tasks: ['jshint', 'uglify']
}
},
bump: {
options: {
files: ['package.json', 'bower.json'],
commit: true,
commitMessage: 'Release %VERSION%',
commitFiles: ['-a'],
createTag: true,
tagName: '%VERSION%',
tagMessage: 'Release %VERSION%',
push: true,
pushTo: 'gh-pages'
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['sass', 'jshint', 'uglify']);
grunt.registerTask('rev:patch', ['bump-only:patch', 'sass', 'jshint', 'uglify', 'bump-commit']);
grunt.registerTask('rev:minor', ['bump-only:minor', 'sass', 'jshint', 'uglify', 'bump-commit']);
grunt.registerTask('rev:major', ['bump-only:major', 'sass', 'jshint', 'uglify', 'bump-commit']);
grunt.registerTask('rev', ['rev:patch']);
};
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ url: "http://openchattanooga.com"
markdown: kramdown
permalink: pretty
highlights: false
exclude:
- bower_components
- node_modules
21 changes: 21 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "openchattanooga.com",
"version": "2.0.0",
"homepage": "https://github.com/openchattanooga/openchattanooga.com",
"authors": [
"Daniel Ryan <[email protected]>"
],
"description": "Open Chattanooga website",
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"bootstrap-sass-official": "~3.1.1+2",
"bourbon": "~4.0.2"
}
}
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "openchattanooga.com",
"version": "2.0.0",
"description": "Open Chattanooga website",
"main": "index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/openchattanooga/openchattanooga.com.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/openchattanooga/openchattanooga.com/issues"
},
"homepage": "http://openchattanooga.com",
"devDependencies": {
"bower": "^1.3.4",
"grunt": "^0.4.5",
"grunt-bump": "0.0.14",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-sass": "^0.7.3",
"grunt-contrib-uglify": "^0.4.0",
"grunt-contrib-watch": "^0.6.1"
}
}

0 comments on commit aa78ea1

Please sign in to comment.