-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Regis Biron
committed
Oct 24, 2014
1 parent
663c266
commit 77b6184
Showing
2 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
|
||
module.exports = function (grunt) { | ||
|
||
// Load grunt tasks automatically | ||
require('load-grunt-tasks')(grunt); | ||
|
||
// Configurable paths | ||
var config = { | ||
dev: 'dev', | ||
dist: 'dist' | ||
}; | ||
|
||
// Define the configuration for all the tasks | ||
grunt.initConfig({ | ||
|
||
// Project settings | ||
config: config, | ||
|
||
// Watches files for changes and runs tasks based on the changed files | ||
watch: { | ||
js: { | ||
files: ['<%= config.dev %>/scripts/{,*/}*.js'], | ||
options: { | ||
livereload: true | ||
} | ||
}, | ||
styles: { | ||
files: ['<%= config.dev %>/scss/{,*/}*.scss'], | ||
tasks: ['sass:dev'], | ||
options: { | ||
livereload: true | ||
} | ||
}, | ||
livereload: { | ||
options: { | ||
livereload: '<%= connect.options.livereload %>' | ||
}, | ||
files: [ | ||
'<%= config.dev %>**/*.html', | ||
'<%= config.dev %>/scss/{,*/}*.scss' | ||
] | ||
} | ||
}, | ||
|
||
// The actual grunt server settings | ||
connect: { | ||
options: { | ||
port: 9000, | ||
open: true, | ||
livereload: 35729, | ||
// Change this to '0.0.0.0' to access the server from outside | ||
hostname: 'localhost' | ||
}, | ||
livereload: { | ||
options: { | ||
middleware: function(connect) { | ||
return [ | ||
connect.static(config.dev) | ||
]; | ||
} | ||
} | ||
} | ||
}, | ||
|
||
sass: { | ||
dist: { | ||
options: { | ||
style: 'compressed' | ||
}, | ||
expand: true, | ||
cwd: '<%= config.dev %>/scss/', | ||
src: ['*.scss'], | ||
dest: '<%= config.dist %>/styles/', | ||
ext: '.css' | ||
}, | ||
dev: { | ||
options: { | ||
style: 'expanded', | ||
debugInfo: true, | ||
lineNumbers: true | ||
}, | ||
expand: true, | ||
cwd: '<%= config.dev %>/scss/', | ||
src: ['*.scss'], | ||
dest: '<%= config.dev %>/styles/', | ||
ext: '.css' | ||
} | ||
}, | ||
|
||
concat: { | ||
dist: { | ||
src: [ | ||
'<%= config.dev %>/scripts/*.js' | ||
], | ||
dest: '.tmp/scripts/main.js', | ||
} | ||
}, | ||
|
||
uglify: { | ||
dist: { | ||
src: '.tmp/scripts/main.js', | ||
dest: '<%= config.dist %>/scripts/main.min.js' | ||
} | ||
}, | ||
|
||
clean: { | ||
dist: { | ||
src: [".tmp/"] | ||
} | ||
}, | ||
|
||
responsive_images: { | ||
dist: { | ||
options: { | ||
engine: 'im' | ||
}, | ||
files: [{ | ||
expand: true, | ||
cwd: '<%= config.dev %>/images', | ||
src: '{,*/}*.{gif,jpeg,jpg,png}', | ||
dest: '<%= config.dist %>/images' | ||
}] | ||
} | ||
} | ||
}); | ||
|
||
|
||
grunt.registerTask('serve', function (target) { | ||
|
||
grunt.task.run([ | ||
'connect:livereload', | ||
'sass:dev', | ||
'watch' | ||
]); | ||
}); | ||
|
||
grunt.registerTask('build', [ | ||
'responsive_images', | ||
'sass:dist', | ||
'concat:dist', | ||
'uglify:dist', | ||
'clean:dist' | ||
]); | ||
|
||
grunt.registerTask('default', [ | ||
|
||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "grunt-practice", | ||
"version": "0.1.0", | ||
"author": "Regis Biron", | ||
"devDependencies": { | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-clean": "^0.6.0", | ||
"grunt-contrib-concat": "^0.5.0", | ||
"grunt-contrib-connect": "^0.8.0", | ||
"grunt-contrib-sass": "^0.8.1", | ||
"grunt-contrib-uglify": "^0.6.0", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"grunt-modernizr": "^0.5.2", | ||
"grunt-responsive-images": "^0.1.3", | ||
"load-grunt-tasks": "^0.6.0" | ||
} | ||
} |