Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Commit

Permalink
adds support to importing css bower dependencies
Browse files Browse the repository at this point in the history
Natively SCSS doesn't support in-place importing of CSS files ( sass/libsass#318 ), but we want to import bower dependencies CSS files into our SCSS files.

The temporary solution ( as suggested by sass/sass#556 (comment) ) is to copy all the CSS files at the bower_components folder as SCSS files so that we can import them.

The implemented solution also uses a watch to perform this copy task automatically on any dependency changes.
  • Loading branch information
pirelenito committed Mar 16, 2014
1 parent e9bdaf6 commit 6f7a352
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
25 changes: 22 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ module.exports = function(grunt) {
options: {
livereload: true
},
},
bowerDependencies: {
files: ['bower_components/**/*.css'],
tasks: ['copy:bowerDependenciesAsSCSS']
}
},

Expand All @@ -68,7 +72,7 @@ module.exports = function(grunt) {
stream: true,
grunt: true
},
tasks: ['watch:livereload', 'connect']
tasks: ['watch:livereload', 'watch:bowerDependencies', 'connect']
}
},

Expand All @@ -92,6 +96,20 @@ module.exports = function(grunt) {
}
},

copy: {
bowerDependenciesAsSCSS: {
files: [
{
expand: true,
cwd: 'bower_components',
src: ['**/*.css', '!**/*.min.css'],
dest: 'bower_components',
ext: ".scss"
}
]
}
},

karma: {
options: {
basePath: '',
Expand Down Expand Up @@ -128,6 +146,7 @@ module.exports = function(grunt) {

grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-parallel');
Expand All @@ -137,8 +156,8 @@ module.exports = function(grunt) {
// It is advisable to use only registered tasks and not their
// plugin implementations.

grunt.registerTask('build', ['sass', 'requirejs']);
grunt.registerTask('dev', 'parallel:dev');
grunt.registerTask('build', ['copy:bowerDependenciesAsSCSS', 'sass', 'requirejs']);
grunt.registerTask('dev', ['copy:bowerDependenciesAsSCSS', 'parallel:dev']);
grunt.registerTask('spec', ['jshint', 'karma:build']);
grunt.registerTask('watch_spec', 'karma:watch');

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"grunt-contrib-requirejs": "~0.4.1",
"grunt-sass": "^0.11.0",
"node-sass": "^0.8.3",
"underscore": "~1.5.2"
"underscore": "~1.5.2",
"grunt-contrib-copy": "^0.5.0"
}
}

0 comments on commit 6f7a352

Please sign in to comment.