-
Notifications
You must be signed in to change notification settings - Fork 0
/
GruntFile.js
96 lines (93 loc) · 3.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
module.exports = function(grunt) {
'use strict';
// Load grunt plugins 'just-in-time'
require('jit-grunt')(grunt);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
dirs: {
css: "assets/css",
js: "assets/js",
scss: "assets/scss"
},
watch: {
options: {
spawn: false // Makes watch run A LOT faster, and also lets you pass variables to the grunt tasks being called
},
js: {
files: ['<%= dirs.js %>/src/*.js','components/**/*.js'],
tasks: ['uglify', 'jshint']
},
scss: {
files: ['<%= dirs.scss %>/*.scss','components/**/*.scss'],
tasks: ['copy:scss','compass','concat:css']
}
},
jshint: {
options: {
jshintrc: true
},
all: ['<%= dirs.js %>/src/*.js','components/**/*.js']
},
compass: {
dist: {
options: {
sassDir: '<%= dirs.scss %>',
cssDir: '<%= dirs.css %>/src',
environment: 'production',
raw: 'preferred_syntax = :scss\n', // Use `raw` since it's not directly available
outputStyle: 'compressed'
}
}
},
concat: {
css: {
options: {
separator: ''
},
src: ['<%= dirs.css %>/src/*.css'],
dest: '<%= dirs.css %>/dist/amarkal-ui.min.css'
}
},
copy: {
scss: {
files: [
{ // Copy UI style files to the js dir
expand: true,
cwd: 'components/',
src: ['**/*.scss'],
dest: '<%= dirs.scss %>/',
filter: 'isFile',
rename: function(dest, src) {
return dest + src.split("/")[src.split("/").length-2] + '.scss';
}
}
]
}
},
uglify: {
main: {
options: {
sourceMap: true,
wrap: 'Amarkal'
},
files: {
'<%= dirs.js %>/dist/amarkal-ui.min.js': [
'<%= dirs.js %>/src/core.js',
'<%= dirs.js %>/src/abstractComponent.js',
'<%= dirs.js %>/src/visibilityManager.js',
'<%= dirs.js %>/src/form.js',
'<%= dirs.js %>/src/jquery.amarkalUIComponent.js',
'<%= dirs.js %>/src/jquery.amarkalUIForm.js',
'components/**/*.js'
]
}
}
}
});
// On watch events configure copy tasks to only run on changed file
grunt.event.on('watch', function(action, filepath) {
grunt.config('copy.scss.files.0.cwd', '');
grunt.config('copy.scss.files.0.src', [filepath]);
});
};