-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
149 lines (135 loc) · 3.53 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
module.exports = function(grunt) {
grunt.initConfig({
devUpdate: {
main: {
options: {
//task options go here
updateType: 'prompt',//'report', //just report outdated packages
reportUpdated: false, //don't report up-to-date packages
semver: false,//true, //stay within semver when updating
packages: {
devDependencies: true, //only check for devDependencies
dependencies: false
},
packageJson: null, //use matchdep default findup to locate package.json
reportOnlyPkgs: [] //use updateType action on all packages
}
}
},
//our JSHint options
jshint: {
//all: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js']
all: ['Gruntfile.js','./javascripts/dev/*.js'] //files to lint
},
//our concat options
concat: {
options: {
separator: ';' //separates scripts
},
dist: {
src: ['./javascripts/dev/*.js'], //Using mini match for your scripts to concatenate
dest: './javascripts/script.js' //where to output the script
}
},
//our uglify options
uglify: {
my_target: {
options: {
mangle: {
except: ['$','jQuery']
},
sourceMap: true,
//sourceMapName: 'path/to/sourcemap.map',
mangleProperties: false,
preserveComments: false,
reserveDOMCache: true,
reserveDOMProperties: true,
//exceptionsFiles: [ 'myExceptionsFile.json' ],
banner: //'/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
"/** \r" +
" * \r" +
" * last update: <%= grunt.template.today('yyyy-mm-dd') %>\r" +
" */"
},
files: {
//'dest/output.min.js': ['src/input1.js', 'src/input2.js']
'./javascripts/script.js': ['./javascripts/script.js'] //save over the newly created script
}
}
},
sass: {
dist: {
options: {
style: 'compressed' //'expanded'
},
files: {
'./stylesheets/btcforks.css': './scss/site.scss'
}
}
},
// postcss/autoprefixer
postcss: {
options: {
map: {
inline: false, // save all sourcemaps as separate files...
annotation: 'stylesheets/'//'dist/css/maps/' // ...to the specified directory
},
processors: [
require('pixrem')(), // add fallbacks for rem units
require('autoprefixer')({browsers: 'last 6 versions'}), // add vendor prefixes
require('cssnano')({zindex: false}) // minify the result
]
},
dist: {
src: "./stylesheets/*.css"
}
},
watch: {
//options: {
// livereload: true,
//},
scripts: {
files: ['./javascripts/dev/*.js'],
tasks: ['jshint','concat', 'uglify'],
options: {
spawn: false,
}
},
css: {
files: ['./scss/*.scss','./scss/base/*.scss'],
tasks: ['sass','postcss'],
options: {
spawn: false,
}
}
},
//browser_sync: {
browserSync: {
files: [
"./stylesheets/*.css",
"./javascripts/*.js"
],
options: {
//server: {
// baseDir: "./"
//},
//proxy: "node",
//reloadDelay: 2000,
open: false,
watchTask: true, // <- watch
injectChanges: true,
ghostMode: {
clicks: false,
location: true,
forms: false,
scroll: true
}
}
}
});
//load our tasks
require('load-grunt-tasks')(grunt);
// register
//grunt.registerTask('dev', ['devUpdate','browserSync','watch']);
grunt.registerTask('dev', ['browserSync','watch']);
};