-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
executable file
·136 lines (122 loc) · 2.84 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
/*
* ____ ____ _____ ____________
* / __ \/ __ \/ _/ | / /_ __/ __ \
* / /_/ / /_/ // // |/ / / / / /_/ /
* / ____/ _, _// // /| / / / / _, _/
* /_/ /_/ |_/___/_/ |_/ /_/ /_/ |_|
*
* Copyright Printr B.V. All rights reserved.
* This code is closed source and should under
* no circumstances be copied or used in other
* applications that for Printr B.V.
*
*/
module.exports = function(grunt) {
window = {};
var json = {
pkg: grunt.file.readJSON('package.json'),
/*
* Concatenate Javascript files
*/
concat: {
options: {
separator: ';\n'
},
files: {
src: [
/*
* Include D3.js
*/
'./bower_components/d3/d3.min.js',
'./bower_components/queue-async/queue.min.js',
/*
* Include JS files
*/
'./javascripts/**/*.js',
],
dest: './application.js'
}
},
/*
* Initialise SASS
*/
sass: {
importer: importOnce,
importOnce: {
index: false,
css: true,
bower: false
},
options: {
outputStyle: 'compressed',
sourceMap: true,
includePaths: ['./bower_components/', './bower_components/css-base/dist/'],
},
dist: {
files: {
'./application.css': './sass/application.scss'
}
}
},
autoprefixer: {
files: {
options: {
browsers: ['last 2 versions'],
map: {
inline: false
}
},
src: './application.css' // globbing is also possible here
},
},
/*
* Watch for changes in directories
*/
watch: {
javascripts: {
files: ['./javascripts/**/*.js'],
tasks: ['concat']
},
sass: {
files: ['./sass/**/*.scss', './css-base/dist/**/*.scss'],
tasks: ['sass', 'autoprefixer']
}
},
bump: {
options: {
files: ['package.json', 'bower.json'],
updateConfigs: [],
commit: true,
commitMessage: 'Release %VERSION%',
commitFiles: ['package.json', 'bower.json'],
createTag: true,
tagName: '%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: false,
regExp: false
}
}
}
require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks
var importOnce = require('node-sass-import-once');
grunt.initConfig();
grunt.config.merge(json);
/*
* Load NPM Plugins
*/
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-autoprefixer');
/*
* Register Tasks
*/
grunt.registerTask('default', ['concat', 'sass', 'autoprefixer']);
};