Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Clean up grunt file

Michał Ociepka18694c502c08
diff --git a/Gruntfile.js b/Gruntfile.js
index 5ec649ad10..8c7dfa0dbb 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,21 +1,16 @@
module.exports = function(grunt) {
grunt.initConfig({
- babel: {
- dist: {
- files: {
- "saleor/static/js/storefront_fromjsx.js": "saleor/static/js_src/storefront.jsx"
- },
- options: {
- stage: 0
- }
- }
+ NODE_MODULES_DIR: 'node_modules/',
+ STATIC_DIR: 'saleor/static/',
+ webpack: {
+ default: require('./webpack.config')
},
browserSync: {
dev: {
bsFiles: {
src: [
- "saleor/static/css/*.css",
- "saleor/static/js/*.js",
+ "<%= STATIC_DIR %>/css/*.css",
+ "<%= STATIC_DIR %>/js/*.js",
"saleor/**/*.html"
]
},
@@ -34,8 +29,8 @@ module.exports = function(grunt) {
{
expand: true,
dot: true,
- cwd: "saleor/static/components/bootstrap-sass/assets/fonts/bootstrap",
- dest: "saleor/static/fonts/",
+ cwd: "<%= NODE_MODULES_DIR %>/bootstrap-sass/assets/fonts/bootstrap",
+ dest: "<%= STATIC_DIR %>/fonts/",
src: [
"*"
]
@@ -43,8 +38,8 @@ module.exports = function(grunt) {
{
expand: true,
dot: true,
- cwd: "saleor/static/components/components-font-awesome/fonts",
- dest: "saleor/static/fonts/",
+ cwd: "<%= NODE_MODULES_DIR %>/font-awesome/fonts",
+ dest: "<%= STATIC_DIR %>/fonts/",
src: [
"*"
]
@@ -52,8 +47,8 @@ module.exports = function(grunt) {
{
expand: true,
dot: true,
- cwd: "saleor/static/components/materialize/font/roboto",
- dest: "saleor/static/fonts/",
+ cwd: "<%= NODE_MODULES_DIR %>/materialize-sass-origin/font/roboto",
+ dest: "<%= STATIC_DIR %>/fonts/",
src: [
"*"
]
@@ -61,8 +56,8 @@ module.exports = function(grunt) {
{
expand: true,
dot: true,
- cwd: "saleor/static/components/materialize/font/material-design-icons",
- dest: "saleor/static/fonts/",
+ cwd: "<%= NODE_MODULES_DIR %>/materialize-sass-origin/font/material-design-icons",
+ dest: "<%= STATIC_DIR %>/fonts/",
src: [
"*"
]
@@ -70,8 +65,8 @@ module.exports = function(grunt) {
{
expand: true,
dot: true,
- cwd: "saleor/static/components/dropzone/dist",
- dest: "saleor/static/scss/vendor/",
+ cwd: "<%= NODE_MODULES_DIR %>/dropzone/dist",
+ dest: "<%= STATIC_DIR %>/scss/vendor/",
src: [
"*.css"
],
@@ -93,54 +88,20 @@ module.exports = function(grunt) {
},
prod: {
src: [
- "saleor/static/css/storefront.css",
- "saleor/static/css/dashboard.css"
+ "<%= STATIC_DIR %>/css/storefront.css",
+ "<%= STATIC_DIR %>/css/dashboard.css"
]
}
},
sass: {
options: {
sourceMap: true,
- includePaths: ["saleor/static/components"]
+ includePaths: ["<%= NODE_MODULES_DIR %>"]
},
dist: {
files: {
- "saleor/static/css/storefront.css": "saleor/static/scss/storefront.scss",
- "saleor/static/css/dashboard.css": "saleor/static/scss/dashboard.scss"
- }
- }
- },
- uglify: {
- options: {
- mangle: false,
- sourceMap: true
- },
- dev: {
- files: {
- "saleor/static/js/dashboard.js": [
- "saleor/static/components/dropzone/dist/dropzone.js",
- "saleor/static/components/jquery/dist/jquery.js",
- "saleor/static/components/materialize/dist/js/materialize.js",
- "saleor/static/components/Sortable/Sortable.js",
- "saleor/static/components/select2/dist/js/select2.js",
- "saleor/static/components/dotdotdot/src/js/jquery.dotdotdot.js",
- "saleor/static/components/jquery.equalheights/jquery.equalheights.js",
- "saleor/static/js_src/dashboard.js"
- ],
- "saleor/static/js/dashboard-head.js": [
- "saleor/static/components/modernizr/modernizr.js"
- ],
- "saleor/static/js/storefront.js": [
- "saleor/static/components/jquery/dist/jquery.js",
- "saleor/static/components/jquery-cookie/jquery.cookie.js",
- "saleor/static/components/react/react-with-addons.js",
- "saleor/static/components/bootstrap-sass/assets/javascripts/bootstrap.js",
- "saleor/static/js/storefront_fromjsx.js",
- "saleor/static/js_src/storefront.js"
- ],
- "saleor/static/js/storefront_head.js": [
- "saleor/static/components/modernizr/modernizr.js"
- ]
+ "<%= STATIC_DIR %>/css/storefront.css": "<%= STATIC_DIR %>/scss/storefront.scss",
+ "<%= STATIC_DIR %>/css/dashboard.css": "<%= STATIC_DIR %>/scss/dashboard.scss"
}
}
},
@@ -152,19 +113,19 @@ module.exports = function(grunt) {
spawn: false
},
sass: {
- files: ["saleor/static/scss/**/*.scss"],
+ files: ["<%= STATIC_DIR %>/scss/**/*.scss"],
tasks: ["sass", "postcss"]
},
uglify: {
- files: ["saleor/static/js_src/**/*.js", "saleor/static/js_src/**/*.jsx"],
- tasks: ["babel", "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", "babel", "uglify"]);
+ grunt.registerTask("default", ["copy", "sass", "postcss", "webpack"]);
grunt.registerTask("sync", ["browserSync", "watch"]);
grunt.registerTask("heroku", ["copy", "sass", "postcss", "babel", "uglify"]);
};