-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
72 lines (62 loc) · 1.94 KB
/
gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
module.exports = function( grunt ) {
// Removes need for grunt.loadNpmTasks like matchdep but faster
require( 'jit-grunt' )( grunt );
// Project Configuration
grunt.initConfig( {
pkg : grunt.file.readJSON( 'package.json' ),
buildSrcFile : 'js/init.js',
buildSrcMinFile : 'js/init.min.js',
buildCssSrcFile : 'css/style.css',
buildCssSrcMinFile : 'css/style.min.css',
uglify : {
options : {
banner : '/**\n' +
' * <%= pkg.name %> - v<%= pkg.version %> - build <%= grunt.template.today("yyyy-mm-dd HH:mm:ss") %>\n' +
' * Copyright (c) 2015 Selcher;\n' +
' * Distributed under the terms of the ISC license.\n' +
' */\n'
},
build : {
src : '<%= buildSrcFile %>',
dest : '<%= buildSrcMinFile %>'
}
},
cssmin : {
css : {
src : '<%= buildCssSrcFile %>',
dest : '<%= buildCssSrcMinFile %>'
}
},
uncss: {
dist: {
files: [
{
src: [ 'index.html' ],
dest: [ 'css/style-clean.css' ]
}
]
}
},
watch : {
files: [ '<%= buildSrcFile %>', '<%= buildCssSrcFile %>' ],
tasks: [ 'cssmin', 'uglify' ]
}
} );
// Load the plugins
// uglify -> minify
// grunt.loadNpmTasks( 'grunt-contrib-uglify' );
// Replace multiple loadNpmTasks with matchdep and let it automatically add them
// require( 'matchdep' ).filterDev( 'grunt-*' ).forEach( grunt.loadNpmTasks );
// load Npm tasks... alertnative to matchdep
// require( 'load-grunt-tasks' )( grunt, [ 'grunt-*', '!grunt-template-jasmine-requirejs' ] );
// Defalt task : just minify code
grunt.registerTask( 'default', [ 'cssmin', 'uglify' ] );
// Development : watch for file changes and run:
// 1. jasmine for code testing
grunt.registerTask( 'dev', [ 'watch' ] );
// Task just seems to be running forever...
// on my local machine, need alternative
grunt.registerTask( 'uncss', [ 'uncss' ] );
// Production : check code and then minify
grunt.registerTask( 'prod', [ 'cssmin', 'uglify' ] );
};