Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 43 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function(grunt) {
compile: {
options: {
baseUrl: './src/js',
out: 'build/js/main.js',
out: 'src/build/js/main.js',
name: 'main',
mainConfigFile: './src/js/main.js',
done: function(done, output) {
Expand Down Expand Up @@ -41,11 +41,33 @@ module.exports = function(grunt) {
yuicompress: true
},
files: {
"build/css/main.css": "src/less/main.less"
"src/build/css/main.css": "src/less/main.less"
}
}
},

watch: {
scripts: {
files: 'src/js/**/*.js',
tasks: ['jshint','requirejs'],
options: {
interrupt: true
}
},
templates: {
files: 'src/js/**/*.hbs',
tasks: ['jshint','requirejs'],
options: {
interrupt: true
}
},
stylesheets: {
files: ['src/less/*.less'],
tasks: ['less'],
options: {
interrupt: true
}
}
},
jshint: {
all:['src/js/**/*.js'],
options: {
Expand Down Expand Up @@ -88,6 +110,24 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-devserver');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-lesslint');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('runNode', function () {
grunt.util.spawn({
cmd: 'node',
args: ['./node_modules/nodemon/nodemon.js', '--debug', 'index.js'],
opts: {
stdio: 'inherit'
}
}, function () {
grunt.fail.fatal(new Error("nodemon quit"));
});
});

grunt.registerTask('compile', ['jshint', 'requirejs', 'less']);

// Run the server and watch for file changes
grunt.registerTask('server', ['runNode','compile', 'watch']);

// Default task(s).
grunt.registerTask('default', ['jshint', 'lesslint', 'less:production', 'requirejs']);
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ In order to see your web application at work run this command:

And then go to `http://localhost:8888`

Alternatively Run Method
-------

To run with autocompile and jshint you can use this command:

./node_modules/grunt-cli/bin/grunt server

To test the optimized version:

http://localhost:8888/index.html

To test the development version:

http://localhost:8888/dev.html


Tests
-----

Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var connect = require('connect');
connect.createServer(
connect.static('src')
).listen(8888);
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
"grunt-devserver": "~0.4.0",
"grunt-contrib-jshint": "~0.4.0",
"grunt-lesslint": "~0.11.0",
"grunt-contrib-watch": "~0.3.1",
"connect": "",
"nodemon": "~0.7.6",
"bower": "1.0.3",
"mocha": "1.12.0",
"karma": "0.9.6",
"karma-sauce-launcher": "~0.1",
"karma-mocha": "git://github.com/WiserTogether/karma-mocha.git#master",
"karma-requirejs": "0.0.3",
"karma-growl-reporter": "0.0.2",
Expand Down
Loading