-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
180 lines (164 loc) · 4.49 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/* jshint node:true */
/* global module */
module.exports = function(grunt) {
// Project configuration.
// Configure your modules name
// Must end in 'module' file names must mirror modules dir name
var MODULE_NAME = 'members-list-module';
// Are we sassing or lessing?
// string: '.scss' or '.less'
var preprocext = '.scss';
//======================================
var MODULE_DIR = MODULE_NAME + '/';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
files: {
rtl: MODULE_DIR + MODULE_NAME + '-rtl.css',
css: MODULE_DIR + MODULE_NAME + '.css',
js: MODULE_DIR + MODULE_NAME + '.js',
preproc: MODULE_DIR + MODULE_NAME + preprocext
},
// https://github.com/sass/node-sass - config
sass: { // Task
dist: { // Target
options: { // Target options
outputStyle: 'expanded',
unixNewlines: true,
indentType: 'tab',
indentWidth: '1',
indentedSyntax: false
},
cwd: MODULE_DIR,
extDot: 'last',
expand: true,
ext: '.css',
flatten: true,
src: ['*.scss'],
dest: MODULE_DIR
/*files: { // Dictionary of files
'<%= files.css %>': '<%= files.preproc %>', // 'destination': 'source'
}*/
}
},
// Uncomment less task to use.
// https://github.com/gruntjs/grunt-contrib-less
/*
less: {
development: {
options: {
paths: [ MODULE_DIR ]
},
files: {
'<%= files.css %>': '<%= files.preproc %>'
}
},
production: {
options: {
paths: [ MODULE_DIR ],
plugins: [
new (require('less-plugin-autoprefix'))({browsers: ["last 2 versions"]}),
new (require('less-plugin-clean-css'))(cleanCssOptions)
],
//modifyVars: {
// imgPath: '"http://mycdn.com/path/to/images"',
// bgColor: 'red'
//}
},
files: {
'<%= files.css %>': '<%= files.preproc %>'
}
}
},
*/
rtlcss: {
options: {
//map: {inline: false},
opts: {
clean: true,
processUrls: false,
autoRename: false
},
saveUnmodified: false,
sourcemap: 'none'
},
buildrtl: {
core: {
expand: true,
cwd: MODULE_DIR,
dest: MODULE_DIR,
ext: '-rtl.css',
src: '<%= files.css %>'
},
files: {
'<%= files.rtl %>' : '<%= files.css %>'
}
}
},
// lint scss files
scsslint: {
options: {
bundleExec: false,
colorizeOutput: true,
config: '.scss-lint.yml'
},
core: [ MODULE_DIR + MODULE_NAME + preprocext ]
},
checkDependencies: {
options: {
packageManager: 'npm'
},
src: {}
},
jshint: {
options: grunt.file.readJSON( '.jshintrc' ),
grunt: {
src: ['Gruntfile.js']
},
core: {
expand: true,
cwd: MODULE_DIR,
src: ['*.js']
// file: 'members-list-module/members-list-module.js'
}
},
watch: {
//scripts: {
//files: ['assets/js/*.js'],
//tasks: ['concat'],
//},
sass: {
files: [
MODULE_DIR + MODULE_NAME + preprocext, 'Gruntfile.js'
],
//options: {
// Reload reloads the watch config for any file change
// not required if wanting to reload on gruntfile changes
// only as it's a default to reload if gruntfile changes
//reload: true
//},
tasks: 'sass'
}
// uncomment to let 'watch' run on less files.
/* less: {
files: [
MODULE_DIR + MODULE_NAME + preprocext,
],
tasks: 'less'
} */
}
});
grunt.loadNpmTasks('grunt-check-dependencies');
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-watch');
//grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-sass');
//grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-scss-lint');
grunt.loadNpmTasks('grunt-rtlcss');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Build rtl css
grunt.registerTask('commit', ['checkDependencies', 'jshint', 'scsslint', 'rtlcss']);
// Default task(s).
// ?
grunt.registerTask('default', ['uglify']);
};