-
Notifications
You must be signed in to change notification settings - Fork 5
/
Gruntfile.js
132 lines (132 loc) · 3.23 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
//run compass on css
compass: {
dist: {
options: {
sassDir: 'sass',
cssDir: 'shop/assets',
specify: 'sass/application.scss',
outputStyle: 'compressed'
}
}
},
//concat bower packages
bower_concat: {
all: {
dest: 'build/_bower.js',
bowerOptions: {
relative: false,
exclude: [
'jquery',
'modernizr'
]
}
}
},
//concat js files after bower concat runs
concat:{
options: {
seperator: ';'
},
dist: {
src: [
'build/_bower.js',
'./custom_js/*.js'
],
dest: 'shop/assets/application.js'
}
},
//minify js
uglify: {
options: {
mangle: false,
compress: {
drop_console: true
}
},
my_target: {
files: {
'shop/assets/application-min.js' : 'assets/application.js',
}
}
},
//Move the bootstrap files from bower to the compass dir
copy: {
main: {
src: 'bower_components/bootstrap/dist/css/bootstrap.css',
dest: 'sass/bootstrap.scss'
}
},
//make sure js is cherry
jshint: {
files: ['Gruntfile.js', './custom_js/*.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
// Generates a custom Modernizr build that includes only the tests you
// reference in your app
modernizr: {
dist: {
devFile: 'bower_components/modernizr/modernizr.js',
outputFile: 'shop/assets/modernizr.js',
files: {
src: [
'shop/assets/{,*/}*.js',
'shop/assets/{,*/}*.css'
]
},
uglify: true
}
},
//upload changed files to shopify
shopify: {
options: {
api_key: "API key",
password: "pass",
url: "url",
base: "shop/"
}
},
watch: {
css: {
files: ['**/*.scss'],
tasks: ['copy:','compass']
},
scripts: {
files: [
'./bower_components/{,*/}*.js',
'./custom_js/shop.js',
'Gruntfile.js'
],
tasks: ['jshint', 'bower_concat', 'concat', 'uglify', 'modernizr']
},
shopify: {
files: ["shop/assets/**", "shop/config/**", "shop/snippets/**", "shop/layout/**", "shop/templates/**" ],
tasks: ["shopify"]
},
options: {
livereload: true,
debounceDelay: 10000
},
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-bower-concat');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-modernizr');
grunt.loadNpmTasks('grunt-shopify');
grunt.registerTask('default',['watch']);
};