Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Updated Grunt file to work with Sass source files. Now requires Ruby …
…as well as the Sass gem.
  • Loading branch information
markleusink committed Feb 10, 2015
1 parent f03d169 commit 2ab401a
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 73 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,3 +1,4 @@
node_modules/ node_modules/
bower_components/ bower_components/
npm-debug.log npm-debug.log
.sass-cache/
93 changes: 26 additions & 67 deletions Gruntfile.js
@@ -1,16 +1,23 @@
module.exports = function(grunt) { module.exports = function(grunt) {


// Project configuration.
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
banner: '/* <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd h:MM") %> */\n', banner: '/* <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd h:MM") %> */\n',


clean: ["dist"], //clean the output folder and unused css files
clean: {
output : {
src: ["dist"]
},
unused : {
src : ['dist/css/bootcards.css*', 'dist/css/bootcards-mobile*']
}
},


//move all js and font source files to the dist folder
copy: { copy: {
main: { main: {
files: [ files: [
// includes files within path
{expand: true, src: ['src/js/*'], dest: 'dist/js/', filter: 'isFile', flatten: true}, {expand: true, src: ['src/js/*'], dest: 'dist/js/', filter: 'isFile', flatten: true},
{expand: true, src: ['src/fonts/*'], dest: 'dist/fonts/', filter: 'isFile', flatten: true} {expand: true, src: ['src/fonts/*'], dest: 'dist/fonts/', filter: 'isFile', flatten: true}
] ]
Expand All @@ -27,62 +34,15 @@ module.exports = function(grunt) {
} }
}, },


concat: { sass: {
cssdesktoplite: { dist: {
options: { banner: '<%= banner %>' }, files: [{
src: [ expand: true,
'src/css/bootcards.css','src/css/bootcards-desktop.css' src: ['src/css/*.scss'],
], dest: 'dist/css',
dest: 'dist/css/bootcards-desktop-lite.css' ext: '.css',
}, flatten: true
cssioslite: { }]
options: { banner: '<%= banner %>' },
src: [
'src/css/bootcards.css','src/css/bootcards-mobile-shared.css','src/css/bootcards-ios.css'
],
dest: 'dist/css/bootcards-ios-lite.css'
},
cssandroidlite: {
options: { banner: '<%= banner %>' },
src: [
'src/css/bootcards.css','src/css/bootcards-mobile-shared.css','src/css/bootcards-android.css'
],
dest: 'dist/css/bootcards-android-lite.css'
},
cssdesktop: {
options: { banner: '<%= banner %>' },
src: [
'bower_components/bootstrap/dist/css/bootstrap.min.css','dist/css/bootcards-desktop-lite.min.css'
],
dest: 'dist/css/bootcards-desktop.min.css'
},
cssios: {
options: { banner: '<%= banner %>' },
src: [
'bower_components/bootstrap/dist/css/bootstrap.min.css','dist/css/bootcards-ios-lite.min.css'
],
dest: 'dist/css/bootcards-ios.min.css'
},
cssandroid: {
options: { banner: '<%= banner %>' },
src: [
'bower_components/bootstrap/dist/css/bootstrap.min.css','dist/css/bootcards-android-lite.min.css'
],
dest: 'dist/css/bootcards-android.min.css'
}
},

replace : {

imports : {
src: [
'dist/css/bootcards-android.css', 'dist/css/bootcards-ios.css'
],
overwrite: true,
replacements : [{
from : /\@import\s\".*\"\;/,
to : ""
}]
} }
}, },


Expand All @@ -101,7 +61,7 @@ module.exports = function(grunt) {


watch : { watch : {
scripts: { scripts: {
files: ['**/*.js', '**/*.html', '**/*.css'], files: ['**/*.js', '**/*.scss'],
tasks: ['default'], tasks: ['default'],
options: { options: {
spawn: false, spawn: false,
Expand All @@ -113,21 +73,20 @@ module.exports = function(grunt) {


// Load the plugin that provides the "uglify"/ contat task. // Load the plugin that provides the "uglify"/ contat task.
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-text-replace'); grunt.loadNpmTasks('grunt-contrib-sass');


// Default task(s). // Default task(s).
grunt.registerTask('default', [ grunt.registerTask('default', [
'clean', 'clean:output',
'copy', 'copy',
'uglify', 'uglify',
'concat:cssdesktoplite','concat:cssioslite','concat:cssandroidlite', 'sass',
'replace:imports', 'clean:unused',
'cssmin:minify', 'cssmin:minify'
'concat:cssdesktop','concat:cssios','concat:cssandroid',]); ]);


}; };
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -16,3 +16,14 @@ Want to help or want to know more? Drop us a note at bootcards@gmail.com. Look f
**License** **License**


Bootcards is released under an MIT license. It contains code from the <a href="http://getbootstrap.com" target="_blank">Twitter Bootstrap</a> and <a href="http://goratchet.com/" target="_blank">Ratchet</a> projects (both also MIT licensed). Bootcards is released under an MIT license. It contains code from the <a href="http://getbootstrap.com" target="_blank">Twitter Bootstrap</a> and <a href="http://goratchet.com/" target="_blank">Ratchet</a> projects (both also MIT licensed).

**Building**

To build the Bootcards source files using Grunt you'll need:

- Node & NPM
- Grunt: npm install -g grunt-cli
- Ruby: check if it's install by running ruby -v in your terminal. (should be Ok if you're on Linux or Mac OS X, otherwise see http://www.ruby-lang.org/en/downloads/)
- Sass: install using Ruby by running: gem install sass

Bootcards uses Grunt to build the source files. You'lou will need Sass too to compile CSS files from the Sass source files.
5 changes: 2 additions & 3 deletions package.json
Expand Up @@ -9,12 +9,11 @@
"devDependencies": { "devDependencies": {
"grunt": "~0.4.4", "grunt": "~0.4.4",
"grunt-contrib-clean": "^0.5.0", "grunt-contrib-clean": "^0.5.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-copy": "^0.5.0", "grunt-contrib-copy": "^0.5.0",
"grunt-contrib-cssmin": "^0.9.0", "grunt-contrib-cssmin": "^0.9.0",
"grunt-contrib-sass": "^0.9.2",
"grunt-contrib-uglify": "^0.7.0", "grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "^0.6.1", "grunt-contrib-watch": "^0.6.1"
"grunt-text-replace": "^0.4.0"
}, },
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
Expand Down
2 changes: 1 addition & 1 deletion src/css/bootcards-android.scss
@@ -1,4 +1,4 @@
@import "bootcards-mobile-shared.css"; @import "bootcards-mobile-shared.scss";


body { body {
background-color: #eee; background-color: #eee;
Expand Down
2 changes: 2 additions & 0 deletions src/css/bootcards-desktop.scss
@@ -1,3 +1,5 @@
@import "bootcards.scss";

body { body {
padding-top: 80px; padding-top: 80px;
background: #f5f5f5; background: #f5f5f5;
Expand Down
2 changes: 1 addition & 1 deletion src/css/bootcards-ios.scss
@@ -1,4 +1,4 @@
@import "bootcards-mobile-shared.css"; @import "bootcards-mobile-shared.scss";


$navbar-height: 44px; $navbar-height: 44px;
$navbar-height-phone-landscape: 32px; $navbar-height-phone-landscape: 32px;
Expand Down
2 changes: 2 additions & 0 deletions src/css/bootcards-mobile-shared.scss
@@ -1,3 +1,5 @@
@import "bootcards.scss";

html, html,
body { body {
height: 100%; height: 100%;
Expand Down

0 comments on commit 2ab401a

Please sign in to comment.