From e1e510c308df53eeed533dcee9828c004fcad6b9 Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Thu, 19 May 2016 17:47:13 +0200 Subject: [PATCH] use libsass (#22) Avoid ruby dependency --- Gruntfile.js | 2 +- README.md | 8 +++----- package.json | 4 +++- tasks/build.js | 23 +++++++++++++++++++---- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index b53c51d..b63ad56 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -17,7 +17,7 @@ module.exports = function (grunt) { grunt.loadTasks("tasks") - grunt.registerTask("default", ["bower-install-simple", "lint", "saveRevision", "copy", "sass", "requirejs"]) + grunt.registerTask("default", ["bower-install-simple", "lint", "saveRevision", "copy", "sass", "postcss", "requirejs"]) grunt.registerTask("lint", ["eslint"]) grunt.registerTask("dev", ["default", "connect:server", "watch"]) } diff --git a/README.md b/README.md index 4cac2ca..587694f 100644 --- a/README.md +++ b/README.md @@ -21,18 +21,16 @@ HopGlass is a frontend for the [HopGlass Server](https://github.com/plumpudding/ # Installing dependencies -Install npm and Sass with your package-manager. On Debian-like systems run: +Install npm package-manager. On Debian-like systems run: - sudo apt-get install npm ruby-sass - -or if you have bundler you can install ruby-sass simply via `bundle install` + sudo apt-get install npm On Mac you have to install only npm via brew and sass /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install node sudo gem install sass - + Execute these commands on your server as a normal user to prepare the dependencies: git clone https://github.com/plumpudding/hopglass diff --git a/package.json b/package.json index c2bc317..d5cbd37 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "test": "node -e \"require('grunt').cli()\" '' clean lint" }, "devDependencies": { + "autoprefixer": "^6.3.3", "grunt": "^0.4.5", "grunt-check-dependencies": "^0.6.0", "grunt-contrib-clean": "^0.6.0", @@ -11,7 +12,8 @@ "grunt-contrib-copy": "^0.5.0", "grunt-contrib-cssmin": "^0.12.2", "grunt-contrib-requirejs": "^0.4.4", - "grunt-contrib-sass": "^0.9.2", + "grunt-sass": "^1.1.0", + "grunt-postcss": "^0.7.2", "grunt-contrib-uglify": "^0.5.1", "grunt-contrib-watch": "^0.6.1", "grunt-eslint": "^10.0.0", diff --git a/tasks/build.js b/tasks/build.js index 7b3ee0a..5a8c918 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -56,15 +56,29 @@ module.exports = function(grunt) { } }, sass: { + options: { + sourceMap: true, + outputStyle: "compressed" + }, dist: { - options: { - style: "compressed" - }, files: { "build/style.css": "scss/main.scss" } } }, + postcss: { + options: { + map: true, + processors: [ + require("autoprefixer")({ + browsers: ["last 2 versions"] + }) + ] + }, + dist: { + src: "build/style.css" + } + }, cssmin: { target: { files: { @@ -106,5 +120,6 @@ module.exports = function(grunt) { grunt.loadNpmTasks("grunt-bower-install-simple") grunt.loadNpmTasks("grunt-contrib-copy") grunt.loadNpmTasks("grunt-contrib-requirejs") - grunt.loadNpmTasks("grunt-contrib-sass") + grunt.loadNpmTasks("grunt-sass") + grunt.loadNpmTasks("grunt-postcss") }