Adding Grunt tasks for Sass

This commit is contained in:
Hannah Wolfe 2014-08-30 19:52:05 +01:00
parent 91b5d27492
commit 2a843c309e
14 changed files with 63 additions and 5120 deletions

6
.gitignore vendored
View File

@ -41,10 +41,6 @@ Session.vim
.dist .dist
.tmp .tmp
/core/client/assets/css
!/core/client/assets/css/ember-hacks.css
/core/client/assets/fonts
/core/server/data/export/exported* /core/server/data/export/exported*
/docs /docs
/_site /_site
@ -67,6 +63,8 @@ config.js
# Built asset files # Built asset files
/core/built /core/built
/core/client/assets/css
/core/client/docs/dist/css
# Coverage reports # Coverage reports
coverage.html coverage.html

View File

@ -30,6 +30,10 @@ core/built/scripts/ghost.js
core/built/**/*.map core/built/**/*.map
core/client/** core/client/**
!core/client/assets/** !core/client/assets/**
core/client/assets/sass/**
core/client/assets/css/**
!core/client/assets/css/ghost.min.css
core/client/docs/**
CONTRIBUTING.md CONTRIBUTING.md
SECURITY.md SECURITY.md
.travis.yml .travis.yml

View File

@ -69,11 +69,11 @@ var path = require('path'),
files: ['core/client/**/*.js'], files: ['core/client/**/*.js'],
tasks: ['clean:tmp', 'transpile', 'concat_sourcemap:dev'] tasks: ['clean:tmp', 'transpile', 'concat_sourcemap:dev']
}, },
'ghost-ui': { sass: {
files: [ files: [
'bower_components/ghost-ui/dist/css/*.css' 'core/client/assets/sass/**/*.scss'
], ],
tasks: ['copy:dev'] tasks: ['css']
}, },
livereload: { livereload: {
files: [ files: [
@ -142,6 +142,7 @@ var path = require('path'),
files: { files: {
src: [ src: [
'core/client/**/*.js', 'core/client/**/*.js',
'!core/client/docs/js/*.js',
'!core/client/assets/vendor/**/*.js', '!core/client/assets/vendor/**/*.js',
'!core/client/tpl/**/*.js' '!core/client/tpl/**/*.js'
] ]
@ -230,16 +231,7 @@ var path = require('path'),
stdin: false 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 // #### Generate coverage report
// See the `grunt test-coverage` task in the section on [Testing](#testing) for more information. // See the `grunt test-coverage` task in the section on [Testing](#testing) for more information.
coverage: { coverage: {
@ -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 // ### grunt-ember-templates
// Compiles handlebar templates for ember // Compiles handlebar templates for ember
emberTemplates: { emberTemplates: {
@ -346,6 +368,12 @@ var path = require('path'),
release: { release: {
src: ['<%= paths.releaseBuild %>/**'] src: ['<%= paths.releaseBuild %>/**']
}, },
css: {
src: [
'core/client/assets/css/**',
'core/client/docs/dist/css/**'
]
},
test: { test: {
src: ['content/data/ghost-test.db'] src: ['content/data/ghost-test.db']
}, },
@ -363,11 +391,6 @@ var path = require('path'),
src: 'jquery.js', src: 'jquery.js',
dest: 'core/built/public/', dest: 'core/built/public/',
expand: true expand: true
}, {
cwd: 'bower_components/ghost-ui/dist/',
src: ['**'],
dest: 'core/client/assets/',
expand: true
}, { }, {
src: 'core/client/config-dev.js', src: 'core/client/config-dev.js',
dest: 'core/client/config.js' dest: 'core/client/config.js'
@ -379,11 +402,6 @@ var path = require('path'),
src: 'jquery.js', src: 'jquery.js',
dest: 'core/built/public/', dest: 'core/built/public/',
expand: true expand: true
}, {
cwd: 'bower_components/ghost-ui/dist/',
src: ['**'],
dest: 'core/client/assets/',
expand: true
}, { }, {
src: 'core/client/config-prod.js', src: 'core/client/config-prod.js',
dest: 'core/client/config.js' dest: 'core/client/config.js'
@ -395,11 +413,6 @@ var path = require('path'),
src: 'jquery.js', src: 'jquery.js',
dest: 'core/built/public/', dest: 'core/built/public/',
expand: true expand: true
}, {
cwd: 'bower_components/ghost-ui/dist/',
src: ['**'],
dest: 'core/client/assets/',
expand: true
}, { }, {
src: 'core/client/config-prod.js', src: 'core/client/config-prod.js',
dest: 'core/client/config.js' dest: 'core/client/config.js'
@ -846,6 +859,11 @@ var path = require('path'),
grunt.registerTask('emberBuildProd', 'Build Ember JS & templates for production', grunt.registerTask('emberBuildProd', 'Build Ember JS & templates for production',
['clean:tmp', 'emberTemplates:prod', 'transpile', 'concat_sourcemap:prod']); ['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 // ### Init assets
// `grunt init` - will run an initial asset build for you // `grunt init` - will run an initial asset build for you
// //
@ -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 // `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 init --verbose` to see if there are any errors.
grunt.registerTask('init', 'Prepare the project for development', grunt.registerTask('init', 'Prepare the project for development',
['shell:bower', 'shell:ghost_ui', 'update_submodules', 'default']); ['shell:bower', 'update_submodules', 'default']);
// ### Production assets // ### Production assets
// `grunt prod` - will build the minified assets used in production. // `grunt prod` - will build the minified assets used in production.
@ -873,7 +891,7 @@ var path = require('path'),
// Compiles concatenates javascript files for the admin UI into a handful of files instead // 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. // of many files, and makes sure the bower dependencies are in the right place.
grunt.registerTask('default', 'Build JS & templates for development', grunt.registerTask('default', 'Build JS & templates for development',
['concat:dev', 'copy:dev', 'emberBuildDev']); ['concat:dev', 'copy:dev', 'css', 'emberBuildDev']);
// ### Live reload // ### Live reload
// `grunt dev` - build assets on the fly whilst developing // `grunt dev` - build assets on the fly whilst developing

View File

@ -10,7 +10,6 @@
"ember-resolver": "git://github.com/stefanpenner/ember-jj-abrams-resolver.git#181251821cf513bb58d3e192faa13245a816f75e", "ember-resolver": "git://github.com/stefanpenner/ember-jj-abrams-resolver.git#181251821cf513bb58d3e192faa13245a816f75e",
"ember-simple-auth": "0.6.4", "ember-simple-auth": "0.6.4",
"fastclick": "1.0.0", "fastclick": "1.0.0",
"ghost-ui": "~0.9",
"handlebars": "1.3.0", "handlebars": "1.3.0",
"ic-ajax": "1.0.1", "ic-ajax": "1.0.1",
"jquery": "1.11.0", "jquery": "1.11.0",
@ -21,6 +20,7 @@
"loader.js": "git://github.com/stefanpenner/loader.js#1.0.0", "loader.js": "git://github.com/stefanpenner/loader.js#1.0.0",
"lodash": "2.4.1", "lodash": "2.4.1",
"moment": "2.4.0", "moment": "2.4.0",
"normalize-scss": "~3.0.1",
"nprogress": "0.1.2", "nprogress": "0.1.2",
"showdown": "git://github.com/ErisDS/showdown.git#v0.3.2-ghost", "showdown": "git://github.com/ErisDS/showdown.git#v0.3.2-ghost",
"validator-js": "3.4.0", "validator-js": "3.4.0",

View File

@ -10,21 +10,6 @@ source: docs
destination: _gh_pages destination: _gh_pages
host: 0.0.0.0 host: 0.0.0.0
port: 9001 port: 9001
baseurl: / baseurl:
url: http://localhost:9001 url: http://localhost:9001
encoding: UTF-8 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

View File

@ -12,7 +12,7 @@
// Libraries: Code by Other Homies // 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/nprogress";
@import "lib/codemirror"; @import "lib/codemirror";

View File

@ -11,11 +11,8 @@
</title> </title>
<!-- Ghost core CSS --> <!-- Ghost core CSS -->
{% if site.github %} <link href="../dist/css/ghost.min.css" rel="stylesheet">
<link href="../dist/css/ghost-ui.min.css" rel="stylesheet">
{% else %}
<link href="../dist/css/ghost-ui.css" rel="stylesheet">
{% endif %}
<!-- Documentation extras --> <!-- Documentation extras -->
{% if site.github %} {% if site.github %}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,7 @@
<meta name="msapplication-TileColor" content="#ffffff"> <meta name="msapplication-TileColor" content="#ffffff">
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:400,300,700"> <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:400,300,700">
<link rel="stylesheet" href="../dist/css/ghost-ui.css" /> <link rel="stylesheet" href="../dist/css/ghost.css" />
</head> </head>
<body class="ember-application settings" data-ember-extension="1"> <body class="ember-application settings" data-ember-extension="1">

View File

@ -30,7 +30,7 @@
<meta name="msapplication-square310x310logo" content="{{asset "img/large.png" ghost="true"}}" /> <meta name="msapplication-square310x310logo" content="{{asset "img/large.png" ghost="true"}}" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:400,300,700" /> <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:400,300,700" />
<link rel="stylesheet" href="{{asset "css/ghost-ui.min.css" ghost="true"}}" /> <link rel="stylesheet" href="{{asset "css/ghost.min.css" ghost="true"}}" />
</head> </head>
<body class="{{bodyClass}}" data-apps="{{apps}}" data-filestorage="{{file_storage}}" data-blogurl="{{blog_url}}"> <body class="{{bodyClass}}" data-apps="{{apps}}" data-filestorage="{{file_storage}}" data-blogurl="{{blog_url}}">

View File

@ -74,6 +74,7 @@
"bower": "~1.3.5", "bower": "~1.3.5",
"grunt": "~0.4.1", "grunt": "~0.4.1",
"grunt-cli": "~0.1.13", "grunt-cli": "~0.1.13",
"grunt-autoprefixer": "1.0.1",
"grunt-concat-sourcemap": "~0.4.3", "grunt-concat-sourcemap": "~0.4.3",
"grunt-contrib-clean": "~0.5.0", "grunt-contrib-clean": "~0.5.0",
"grunt-contrib-compress": "~0.5.2", "grunt-contrib-compress": "~0.5.2",
@ -87,6 +88,7 @@
"grunt-es6-module-transpiler": "~0.6.0", "grunt-es6-module-transpiler": "~0.6.0",
"grunt-express-server": "~0.4.11", "grunt-express-server": "~0.4.11",
"grunt-mocha-cli": "~1.4.0", "grunt-mocha-cli": "~1.4.0",
"grunt-sass": "~0.14.0",
"grunt-shell": "~0.7.0", "grunt-shell": "~0.7.0",
"grunt-update-submodules": "~0.4.0", "grunt-update-submodules": "~0.4.0",
"matchdep": "~0.3.0", "matchdep": "~0.3.0",