-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGruntfile.js
98 lines (85 loc) · 2 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
/**
* Grunt Task Runner
*
* This is simply to facilitate local development. To build any files, use the
* according Metalsmith plugin.
*/
module.exports = function(grunt) {
// Get any options
// type takes 'prerelease', 'patch', 'minor', 'major'
var type = grunt.option('type') || 'patch';
// Load all grunt plugins
require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks);
// Create the Grunt configuration
var config = {
// Load data from package.json
pkg: grunt.file.readJSON('package.json'),
// Code compliance
htmllint: {
tandem: {
options: {
force: true,
htmllintrc: true,
},
src: [
'templates/**/*.html',
'templates/**/**/*.html',
'!templates/components/organisms/sf/*.html' // @todo: remove SVG in here?
]
}
},
sasslint: {
options: {
configFile: '.sass-lint.yml',
},
target: [
'src/**/*.scss',
'templates/**/*.scss'
]
},
// Execute Metalsmith
exec: {
build: {
cmd: 'npm run build'
},
},
// Production performance helpers
uglify: {
options: {
compress: {
global_defs: {
'DEBUG': false
},
dead_code: true
}
},
deploy: {
files: {
'build/js/scripts.min.js': ['build/js/scripts.js']
}
}
},
// Watch files and run tasks when changed
watch: {
all: {
files: [
'src/**/*',
'assets/**/*',
'templates/**/*'
],
tasks: ['build'],
options: {
spawn: false,
interupt: true,
livereload: false
},
},
}
};
// Initialize the configuration.
grunt.initConfig(config);
// Register tasks
grunt.registerTask('build', ['exec:build', 'uglify']);
grunt.registerTask('default', ['build', 'watch']);
grunt.registerTask('test', ['htmllint', 'sasslint', 'build']);
};