Skip to content

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

Improve Grunt config, add Bower and Node packages

Paweł Kowalewski58f7d2aef39c
diff --git a/.gitignore b/.gitignore
index 4ae84cf71d..083c7f1c47 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,7 +8,6 @@
*.log
*.pot
*.pyc
-*/static/components
local_settings.py
dev.sqlite
build/
@@ -17,4 +16,7 @@ dist/
#data
/media/
/static/
+/saleor/static/components/
+/saleor/static/css/
+/saleor/static/js/
/node_modules/
diff --git a/Gruntfile.js b/Gruntfile.js
index cf3ececb42..19d940a0a3 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,5 +1,22 @@
module.exports = function(grunt) {
grunt.initConfig({
+ browserSync: {
+ dev: {
+ bsFiles: {
+ src: [
+ 'saleor/static/css/*.css',
+ 'saleor/static/js/*.js',
+ 'saleor/**/*.html'
+ ]
+ },
+ options: {
+ open: false,
+ port: "3004",
+ proxy: "localhost:8000",
+ watchTask: true
+ }
+ }
+ },
copy: {
production: {
files: [
@@ -30,6 +47,24 @@ module.exports = function(grunt) {
"*"
]
},
+ {
+ expand: true,
+ dot: true,
+ cwd: "saleor/static/components/materialize/font/roboto",
+ dest: "saleor/static/dist/fonts/",
+ src: [
+ "*"
+ ]
+ },
+ {
+ expand: true,
+ dot: true,
+ cwd: "saleor/static/components/materialize/font/material-design-icons",
+ dest: "saleor/static/dist/fonts/",
+ src: [
+ "*"
+ ]
+ },
{
expand: true,
dot: true,
@@ -73,12 +108,76 @@ module.exports = function(grunt) {
"saleor/static/css/dashboard.css": "saleor/static/less/dashboard.less"
}
}
+ },
+ postcss: {
+ options: {
+ map: true,
+ processors: [
+ require('autoprefixer-core'),
+ require('csswring')
+ ]
+ },
+ prod: {
+ src: "saleor/static/css/dashboard.css"
+ }
+ },
+ sass: {
+ options: {
+ sourceMap: true,
+ includePaths: ["saleor/static/components"]
+ },
+ dist: {
+ files: {
+ "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/jquery/dist/jquery.js",
+ "saleor/static/components/materialize/dist/js/materialize.js",
+ "saleor/static/js_src/dashboard.js"
+ ]
+ }
+ }
+ },
+ watch: {
+ options: {
+ atBegin: true,
+ interrupt: false,
+ livereload: true,
+ spawn: false
+ },
+ sass: {
+ files: ["saleor/static/scss/**/*.scss"],
+ tasks: ["sass", "postcss"]
+ },
+ uglify: {
+ files: ["saleor/static/js/**/*.js"],
+ tasks: ["uglify"]
+ },
+ html: {
+ files: ["saleor/dashboard/**/*.html"],
+ tasks: []
+ }
}
});
+ grunt.loadNpmTasks("grunt-browser-sync");
grunt.loadNpmTasks("grunt-contrib-copy");
- grunt.loadNpmTasks('grunt-contrib-less');
+ grunt.loadNpmTasks("grunt-contrib-less");
+ grunt.loadNpmTasks("grunt-contrib-uglify");
+ grunt.loadNpmTasks("grunt-contrib-watch");
+ grunt.loadNpmTasks("grunt-postcss");
+ grunt.loadNpmTasks("grunt-sass");
- grunt.registerTask('default', ['copy', 'less']);
- grunt.registerTask('heroku', ['copy', 'less']);
+ grunt.registerTask("default", ["copy", "less", "sass", "postcss", "uglify"]);
+ grunt.registerTask("sync", ["browserSync", "watch"]);
+ grunt.registerTask("heroku", ["copy", "less", "sass", "postcss", "uglify"]);
};
diff --git a/bower.json b/bower.json
index 682ef7de59..866daf50d5 100644
--- a/bower.json
+++ b/bower.json
@@ -10,6 +10,8 @@
"less": "~2.4.0",
"bootstrap": "~3.3.2",
"components-font-awesome": "~4.3.0",
- "zocial-less": "~1.0.0"
+ "zocial-less": "~1.0.0",
+ "materialize": "~0.96.1",
+ "jquery": "~2.1.4"
}
}
diff --git a/package.json b/package.json
index 942c876078..49005f4b81 100644
--- a/package.json
+++ b/package.json
@@ -16,10 +16,17 @@
"node": "0.10.x"
},
"devDependencies": {
- "bower": "^1.3.12",
- "grunt": "~0.4.5",
- "grunt-cli": "^0.1.13",
- "grunt-contrib-copy": "~0.6.0",
- "grunt-contrib-less": "~0.11.2"
+ "bower": "^1.3.12",
+ "grunt": "~0.4.5",
+ "grunt-cli": "^0.1.13",
+ "grunt-contrib-copy": "~0.6.0",
+ "grunt-contrib-less": "~0.11.2",
+ "grunt-sass": "~1.0.0",
+ "grunt-contrib-watch": "~0.6.1",
+ "grunt-contrib-uglify": "~0.9.1",
+ "grunt-browser-sync": "~2.1.3",
+ "grunt-postcss": "~0.4.0",
+ "autoprefixer-core": "~5.2.0",
+ "csswring": "~3.0.5"
}
}