Skip to content

Commit

Permalink
Adding Grunt tasks for Sass
Browse files Browse the repository at this point in the history
  • Loading branch information
ErisDS committed Aug 31, 2014
1 parent 91b5d27 commit 2a843c3
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 5,120 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ Session.vim
.dist
.tmp


/core/client/assets/css
!/core/client/assets/css/ember-hacks.css
/core/client/assets/fonts
/core/server/data/export/exported*
/docs
/_site
Expand All @@ -67,6 +63,8 @@ config.js

# Built asset files
/core/built
/core/client/assets/css
/core/client/docs/dist/css

# Coverage reports
coverage.html
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ core/built/scripts/ghost.js
core/built/**/*.map
core/client/**
!core/client/assets/**
core/client/assets/sass/**
core/client/assets/css/**
!core/client/assets/css/ghost.min.css
core/client/docs/**
CONTRIBUTING.md
SECURITY.md
.travis.yml
Expand Down
78 changes: 48 additions & 30 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ var path = require('path'),
files: ['core/client/**/*.js'],
tasks: ['clean:tmp', 'transpile', 'concat_sourcemap:dev']
},
'ghost-ui': {
sass: {
files: [
'bower_components/ghost-ui/dist/css/*.css'
'core/client/assets/sass/**/*.scss'
],
tasks: ['copy:dev']
tasks: ['css']
},
livereload: {
files: [
Expand Down Expand Up @@ -142,6 +142,7 @@ var path = require('path'),
files: {
src: [
'core/client/**/*.js',
'!core/client/docs/js/*.js',
'!core/client/assets/vendor/**/*.js',
'!core/client/tpl/**/*.js'
]
Expand Down Expand Up @@ -230,16 +231,7 @@ var path = require('path'),
stdin: false
}
},
// #### Update Ghost-UI
// Used as part of `grunt init`. See the section on [Building Assets](#building%20assets) for more
// information.
ghost_ui: {
command: path.resolve(cwd + '/node_modules/.bin/bower update ghost-ui --allow-root'),
options: {
stdout: true,
stdin: false
}
},

// #### Generate coverage report
// See the `grunt test-coverage` task in the section on [Testing](#testing) for more information.
coverage: {
Expand All @@ -251,6 +243,36 @@ var path = require('path'),
}
},

// ### grunt-sass
// compile sass to css
sass: {
compress: {
options: {
style: 'compressed',
sourceMap: true
},
files: {
'core/client/assets/css/<%= pkg.name %>.min.css': 'core/client/assets/sass/screen.scss',
'core/client/docs/dist/css/<%= pkg.name %>.min.css': 'core/client/assets/sass/screen.scss'
}
}
},

// ### grunt-autoprefixer
// Autoprefix all the things, for the last 2 versions of major browsers
autoprefixer: {
options: {
silent: true, // suppress logging
map: true, // Use and update the sourcemap
browsers: ["last 2 versions", "> 1%", "Explorer 10"]
},
single_file: {
src: 'core/client/assets/css/<%= pkg.name %>.min.css',
dest: 'core/client/assets/css/<%= pkg.name %>.min.css'
}
},


// ### grunt-ember-templates
// Compiles handlebar templates for ember
emberTemplates: {
Expand Down Expand Up @@ -346,6 +368,12 @@ var path = require('path'),
release: {
src: ['<%= paths.releaseBuild %>/**']
},
css: {
src: [
'core/client/assets/css/**',
'core/client/docs/dist/css/**'
]
},
test: {
src: ['content/data/ghost-test.db']
},
Expand All @@ -363,11 +391,6 @@ var path = require('path'),
src: 'jquery.js',
dest: 'core/built/public/',
expand: true
}, {
cwd: 'bower_components/ghost-ui/dist/',
src: ['**'],
dest: 'core/client/assets/',
expand: true
}, {
src: 'core/client/config-dev.js',
dest: 'core/client/config.js'
Expand All @@ -379,11 +402,6 @@ var path = require('path'),
src: 'jquery.js',
dest: 'core/built/public/',
expand: true
}, {
cwd: 'bower_components/ghost-ui/dist/',
src: ['**'],
dest: 'core/client/assets/',
expand: true
}, {
src: 'core/client/config-prod.js',
dest: 'core/client/config.js'
Expand All @@ -395,11 +413,6 @@ var path = require('path'),
src: 'jquery.js',
dest: 'core/built/public/',
expand: true
}, {
cwd: 'bower_components/ghost-ui/dist/',
src: ['**'],
dest: 'core/client/assets/',
expand: true
}, {
src: 'core/client/config-prod.js',
dest: 'core/client/config.js'
Expand Down Expand Up @@ -846,6 +859,11 @@ var path = require('path'),
grunt.registerTask('emberBuildProd', 'Build Ember JS & templates for production',
['clean:tmp', 'emberTemplates:prod', 'transpile', 'concat_sourcemap:prod']);

// ### CSS Build *(Utility Task)*
// Build the CSS files from the SCSS files
grunt.registerTask('css', 'Build Client CSS',
['sass', 'autoprefixer']);

// ### Init assets
// `grunt init` - will run an initial asset build for you
//
Expand All @@ -858,7 +876,7 @@ var path = require('path'),
// `bower` does have some quirks, such as not running as root. If you have problems please try running
// `grunt init --verbose` to see if there are any errors.
grunt.registerTask('init', 'Prepare the project for development',
['shell:bower', 'shell:ghost_ui', 'update_submodules', 'default']);
['shell:bower', 'update_submodules', 'default']);

// ### Production assets
// `grunt prod` - will build the minified assets used in production.
Expand All @@ -873,7 +891,7 @@ var path = require('path'),
// Compiles concatenates javascript files for the admin UI into a handful of files instead
// of many files, and makes sure the bower dependencies are in the right place.
grunt.registerTask('default', 'Build JS & templates for development',
['concat:dev', 'copy:dev', 'emberBuildDev']);
['concat:dev', 'copy:dev', 'css', 'emberBuildDev']);

// ### Live reload
// `grunt dev` - build assets on the fly whilst developing
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"ember-resolver": "git://github.com/stefanpenner/ember-jj-abrams-resolver.git#181251821cf513bb58d3e192faa13245a816f75e",
"ember-simple-auth": "0.6.4",
"fastclick": "1.0.0",
"ghost-ui": "~0.9",
"handlebars": "1.3.0",
"ic-ajax": "1.0.1",
"jquery": "1.11.0",
Expand All @@ -21,6 +20,7 @@
"loader.js": "git://github.com/stefanpenner/loader.js#1.0.0",
"lodash": "2.4.1",
"moment": "2.4.0",
"normalize-scss": "~3.0.1",
"nprogress": "0.1.2",
"showdown": "git://github.com/ErisDS/showdown.git#v0.3.2-ghost",
"validator-js": "3.4.0",
Expand Down
17 changes: 1 addition & 16 deletions core/client/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,6 @@ source: docs
destination: _gh_pages
host: 0.0.0.0
port: 9001
baseurl: /
baseurl:
url: http://localhost:9001
encoding: UTF-8

# Custom vars
current_version: 2.0.0
repo: https://github.com/TryGhost/Ghost-UI

download:
source: https://github.com/TryGhost/ghost-ui/releases/
dist: https://github.com/TryGhost/ghost-ui/releases/

blog: http://dev.ghost.org
expo: http://dev.ghost.org

cdn:
css: //ghost.org/ghost-ui/0.1.0/css/ghost-ui.min.css
js: //ghost.org/ghost-ui/0.1.0/js/ghost-ui.min.js
2 changes: 1 addition & 1 deletion core/client/assets/sass/screen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// Libraries: Code by Other Homies
// --------------------------------------------------

@import "../bower_components/normalize-scss/_normalize"; // via Bower
@import "../../../../bower_components/normalize-scss/_normalize"; // via Bower
@import "lib/nprogress";
@import "lib/codemirror";

Expand Down
7 changes: 2 additions & 5 deletions core/client/docs/_includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
</title>

<!-- Ghost core CSS -->
{% if site.github %}
<link href="../dist/css/ghost-ui.min.css" rel="stylesheet">
{% else %}
<link href="../dist/css/ghost-ui.css" rel="stylesheet">
{% endif %}
<link href="../dist/css/ghost.min.css" rel="stylesheet">


<!-- Documentation extras -->
{% if site.github %}
Expand Down
Loading

0 comments on commit 2a843c3

Please sign in to comment.