From 9ff2d2683d3ca68d237f3e713c516d43c997f47f Mon Sep 17 00:00:00 2001 From: Raivis Vitols Date: Thu, 7 Apr 2016 12:54:20 +0300 Subject: [PATCH] Getting rid of Compass, now styling & compiling is done via Grunt --- .gitignore | 2 +- Gruntfile.js | 47 ++++++++++++++++++ README.md | 9 ++-- assets/js/script.js | 49 +------------------ assets/scss/config.rb | 5 -- assets/src/js/script.js | 48 ++++++++++++++++++ .../{scss => src/sass}/helpers/_classes.scss | 0 .../{scss => src/sass}/helpers/_mixins.scss | 0 assets/{scss => src/sass}/print.scss | 0 assets/{scss => src/sass}/styles.scss | 0 .../{scss => src/sass}/vendor/_normalize.scss | 0 package.json | 20 +++++--- 12 files changed, 115 insertions(+), 65 deletions(-) create mode 100755 Gruntfile.js delete mode 100644 assets/scss/config.rb create mode 100644 assets/src/js/script.js rename assets/{scss => src/sass}/helpers/_classes.scss (100%) rename assets/{scss => src/sass}/helpers/_mixins.scss (100%) rename assets/{scss => src/sass}/print.scss (100%) rename assets/{scss => src/sass}/styles.scss (100%) rename assets/{scss => src/sass}/vendor/_normalize.scss (100%) diff --git a/.gitignore b/.gitignore index 0d31019..c2658d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -.sass-cache/ +node_modules/ diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100755 index 0000000..2a89ad1 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,47 @@ +module.exports = function (grunt) { + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + + sass: { + dist: { + files: { + 'assets/css/styles.css': 'assets/src/sass/styles.scss', + 'assets/css/print.css': 'assets/src/sass/print.scss' + }, + + options: { + sourcemap: 'none', + outputStyle: 'compressed' + } + } + }, + + uglify: { + script: { + files: { + 'assets/js/script.js': [ + 'assets/src/js/vendor/*.js', + 'assets/src/js/*.js' + ] + } + } + }, + + watch: { + css: { + files: 'assets/src/sass/**/*.scss', + tasks: ['sass'] + }, + + js: { + files: 'assets/src/js/**/*.js', + tasks: ['uglify'] + } + } + }); + + grunt.loadNpmTasks('grunt-sass'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.registerTask('default', ['watch']); +}; \ No newline at end of file diff --git a/README.md b/README.md index aa77536..e1998a0 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,15 @@ Personal, responsive, minimalist and open-source theme for Ghost blogging platfo ## Demo -This theme is currenly used on my [personal blog](https://raivis.com/). +This theme is currently used on my [personal blog](https://raivis.com/). ## Styling & Compiling -Requires [Compass](http://compass-style.org/) framework to be installed. +Requires Grunt task runner & NPM to be installed. - $ cd content/themes/[theme-folder]/assets/scss - $ compass watch ./ + $ cd content/themes/[theme-folder] + $ npm install + $ grunt ## Adding Disqus diff --git a/assets/js/script.js b/assets/js/script.js index 95e8c9f..c04d296 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -1,48 +1 @@ -/* - | ----------------------------------------------------------------------------- - | Functionality for off-canvas menu / sidebar visibility - | ----------------------------------------------------------------------------- -*/ - -/*jslint browser:true*/ - -(function (document) { - 'use strict'; - - document.addEventListener('DOMContentLoaded', function () { - var menu = document.getElementById('mobile-menu'), - wrapper = document.getElementById('wrapper'), - content = document.getElementById('content'), - menuVisibilityData = 'data-menu-visible'; - - /* - | --------------------------------------------------------------------- - | Click on content element results in menu getting closed - | --------------------------------------------------------------------- - */ - content.addEventListener('click', function (event) { - if (wrapper.getAttribute(menuVisibilityData)) { - wrapper.removeAttribute(menuVisibilityData); - - event.preventDefault(); - event.stopPropagation(); - } - }); - - /* - | --------------------------------------------------------------------- - | Click on menu element results in menu getting opened - | --------------------------------------------------------------------- - */ - menu.addEventListener('click', function (event) { - if (!wrapper.getAttribute(menuVisibilityData)) { - wrapper.setAttribute(menuVisibilityData, '1'); - } else { - wrapper.removeAttribute(menuVisibilityData); - } - - event.preventDefault(); - event.stopPropagation(); - }); - }); -}(document)); \ No newline at end of file +!function(a){"use strict";a.addEventListener("DOMContentLoaded",function(){var b=a.getElementById("mobile-menu"),c=a.getElementById("wrapper"),d=a.getElementById("content"),e="data-menu-visible";d.addEventListener("click",function(a){c.getAttribute(e)&&(c.removeAttribute(e),a.preventDefault(),a.stopPropagation())}),b.addEventListener("click",function(a){c.getAttribute(e)?c.removeAttribute(e):c.setAttribute(e,"1"),a.preventDefault(),a.stopPropagation()})})}(document); \ No newline at end of file diff --git a/assets/scss/config.rb b/assets/scss/config.rb deleted file mode 100644 index 20be464..0000000 --- a/assets/scss/config.rb +++ /dev/null @@ -1,5 +0,0 @@ -sass_dir = "./" -css_dir = "../css" -images_dir = "../img" -environment = :production -output_style = :compressed \ No newline at end of file diff --git a/assets/src/js/script.js b/assets/src/js/script.js new file mode 100644 index 0000000..95e8c9f --- /dev/null +++ b/assets/src/js/script.js @@ -0,0 +1,48 @@ +/* + | ----------------------------------------------------------------------------- + | Functionality for off-canvas menu / sidebar visibility + | ----------------------------------------------------------------------------- +*/ + +/*jslint browser:true*/ + +(function (document) { + 'use strict'; + + document.addEventListener('DOMContentLoaded', function () { + var menu = document.getElementById('mobile-menu'), + wrapper = document.getElementById('wrapper'), + content = document.getElementById('content'), + menuVisibilityData = 'data-menu-visible'; + + /* + | --------------------------------------------------------------------- + | Click on content element results in menu getting closed + | --------------------------------------------------------------------- + */ + content.addEventListener('click', function (event) { + if (wrapper.getAttribute(menuVisibilityData)) { + wrapper.removeAttribute(menuVisibilityData); + + event.preventDefault(); + event.stopPropagation(); + } + }); + + /* + | --------------------------------------------------------------------- + | Click on menu element results in menu getting opened + | --------------------------------------------------------------------- + */ + menu.addEventListener('click', function (event) { + if (!wrapper.getAttribute(menuVisibilityData)) { + wrapper.setAttribute(menuVisibilityData, '1'); + } else { + wrapper.removeAttribute(menuVisibilityData); + } + + event.preventDefault(); + event.stopPropagation(); + }); + }); +}(document)); \ No newline at end of file diff --git a/assets/scss/helpers/_classes.scss b/assets/src/sass/helpers/_classes.scss similarity index 100% rename from assets/scss/helpers/_classes.scss rename to assets/src/sass/helpers/_classes.scss diff --git a/assets/scss/helpers/_mixins.scss b/assets/src/sass/helpers/_mixins.scss similarity index 100% rename from assets/scss/helpers/_mixins.scss rename to assets/src/sass/helpers/_mixins.scss diff --git a/assets/scss/print.scss b/assets/src/sass/print.scss similarity index 100% rename from assets/scss/print.scss rename to assets/src/sass/print.scss diff --git a/assets/scss/styles.scss b/assets/src/sass/styles.scss similarity index 100% rename from assets/scss/styles.scss rename to assets/src/sass/styles.scss diff --git a/assets/scss/vendor/_normalize.scss b/assets/src/sass/vendor/_normalize.scss similarity index 100% rename from assets/scss/vendor/_normalize.scss rename to assets/src/sass/vendor/_normalize.scss diff --git a/package.json b/package.json index f1a3e91..4abc0c8 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,14 @@ { - "name": "Willow", - "version": "0.1.0", - "author": { - "name": "Raivis Vitols", - "url": "http://raivis.com" - } -} + "name": "Willow", + "version": "0.1.0", + "author": { + "name": "Raivis Vitols", + "url": "http://raivis.com" + }, + "devDependencies": { + "grunt": "~1.0.1", + "grunt-sass": "~1.1.0", + "grunt-contrib-watch": "~1.0.0", + "grunt-contrib-uglify": "~1.0.1" + } +} \ No newline at end of file -- 2.34.1