Skip to content

Instantly share code, notes, and snippets.

@gmurphey
Last active December 17, 2015 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmurphey/5601621 to your computer and use it in GitHub Desktop.
Save gmurphey/5601621 to your computer and use it in GitHub Desktop.
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
options: {
jshintrc: ".jshintrc"
},
files: ["Gruntfile.js", "app/**/*.js", "test/qunit/tests/**/*.js"]
},
requirejs: {
compile: {
options: {
mainConfigFile: "app/config.js",
out: "dist/debug/require.js",
name: "config",
wrap: false
}
}
},
concat: {
options: {
separator: ";"
},
all: {
src: ["vendor/js/libs/almond.js", "dist/debug/templates.js", "dist/debug/require.js"],
dest: "dist/debug/require.js",
}
},
cssmin: {
all: {
src: ["dist/debug/index.css"],
dest: "dist/release/"
}
},
uglify: {
all: {
"dist/release/require.js": ["dist/debug/require.js"]
}
},
connect: {
options: {
hostname: "*",
port: 80,
keepalive: true,
middleware: function (connect, options) {
return [
require('connect-conductor').route(options),
connect.static(options.base)
];
}
},
all: { },
debug: {
options: {
routes: {
"/app/styles/*path": "/dist/debug/[path]",
"/app/*path": "/dist/debug/[path]",
"/vendor/js/libs/*path": "/dist/debug/[path]"
}
}
},
release: {
options: {
routes: {
"/app/styles/*path": "/dist/release/[path]",
"/app/*path": "/dist/release/[path]",
"/vendor/js/libs/*path": "/dist/release/[path]"
}
}
}
},
qunit: {
all: ["test/qunit/*.html"]
},
less: {
files: {
"app/styles/index.css": "app/styles/less/index.less"
}
},
watch: {
all: {
files: ["Gruntfile.js", "app/**/*.js", "test/qunit/tests/**/*.js"],
tasks: ["jshint", "qunit"]
},
css: {
files: ["app/styles/less/**/*.less"],
tasks: ["less"]
}
},
clean: ["dist/"]
});
grunt.registerTask("test", ["jshint", "qunit"]);
grunt.registerTask("debug", ["clean", "jshint", "requirejs", "concat"]);
grunt.registerTask("release", ["debug", "uglify", "cssmin"]);
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-requirejs");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-qunit");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-connect");
};
{
"name": "backbone-boilerplate",
"version": "0.1.0",
"dependencies": {
"grunt": "~0.4",
"grunt-contrib-jshint": "~0.4.3",
"grunt-contrib-requirejs": "~0.4.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-cssmin": "~0.6.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-qunit": "~0.2.1",
"grunt-contrib-watch": "~0.4.3",
"grunt-contrib-clean": "~0.4.1",
"grunt-contrib-connect": "~0.3.0",
"connect-conductor": "0.0.4",
"grunt-contrib-less": "~0.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment