forked from saleor/saleor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
130 lines (128 loc) · 3.24 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
module.exports = function(grunt) {
grunt.initConfig({
NODE_MODULES_DIR: 'node_modules/',
STATIC_DIR: 'saleor/static/',
webpack: {
default: require('./webpack.config')
},
browserSync: {
dev: {
bsFiles: {
src: [
"<%= STATIC_DIR %>/css/*.css",
"<%= STATIC_DIR %>/js/*.js",
"saleor/**/*.html"
]
},
options: {
open: false,
port: "3004",
proxy: "localhost:8000",
reloadOnRestart: true,
watchTask: true
}
}
},
copy: {
production: {
files: [
{
expand: true,
dot: true,
cwd: "<%= NODE_MODULES_DIR %>/bootstrap-sass/assets/fonts/bootstrap",
dest: "<%= STATIC_DIR %>/fonts/",
src: [
"*"
]
},
{
expand: true,
dot: true,
cwd: "<%= NODE_MODULES_DIR %>/font-awesome/fonts",
dest: "<%= STATIC_DIR %>/fonts/",
src: [
"*"
]
},
{
expand: true,
dot: true,
cwd: "<%= NODE_MODULES_DIR %>/materialize-sass-origin/font/roboto",
dest: "<%= STATIC_DIR %>/fonts/",
src: [
"*"
]
},
{
expand: true,
dot: true,
cwd: "<%= NODE_MODULES_DIR %>/materialize-sass-origin/font/material-design-icons",
dest: "<%= STATIC_DIR %>/fonts/",
src: [
"*"
]
},
{
expand: true,
dot: true,
cwd: "<%= NODE_MODULES_DIR %>/dropzone/dist",
dest: "<%= STATIC_DIR %>/scss/vendor/",
src: [
"*.css"
],
rename: function(dest, src) {
src = "_" + src;
return dest + src.replace(/\.css$/, ".scss");
}
}
]
}
},
postcss: {
options: {
map: true,
processors: [
require("autoprefixer")
]
},
prod: {
src: [
"<%= STATIC_DIR %>/css/storefront.css",
"<%= STATIC_DIR %>/css/dashboard.css"
]
}
},
sass: {
options: {
sourceMap: true,
includePaths: ["<%= NODE_MODULES_DIR %>"]
},
dist: {
files: {
"<%= STATIC_DIR %>/css/storefront.css": "<%= STATIC_DIR %>/scss/storefront.scss",
"<%= STATIC_DIR %>/css/dashboard.css": "<%= STATIC_DIR %>/scss/dashboard.scss"
}
}
},
watch: {
options: {
atBegin: true,
interrupt: false,
livereload: true,
spawn: false
},
sass: {
files: ["<%= STATIC_DIR %>/scss/**/*.scss"],
tasks: ["sass", "postcss"]
},
uglify: {
files: ["<%= STATIC_DIR %>/js_src/**/*.js", "<%= STATIC_DIR %>/js_src/**/*.jsx"],
tasks: ["webpack"]
}
}
});
require("load-grunt-tasks")(grunt);
grunt.registerTask("default", ["copy", "sass", "postcss", "webpack"]);
grunt.registerTask("sync", ["browserSync", "watch"]);
grunt.registerTask("heroku", ["copy", "sass", "postcss", "webpack"]);
};