Permalink
Browse files

Move config.src and config.dest into the native file area

  • Loading branch information...
1 parent 95116d0 commit 239e19b6e1bd7ebe4ef3ac574b7b6b422674b30e @jefflembeck jefflembeck committed Dec 12, 2013
Showing with 11 additions and 16 deletions.
  1. +2 −4 Gruntfile.js
  2. +1 −1 package.json
  3. +8 −11 tasks/grunticon.js
View
6 Gruntfile.js
@@ -33,12 +33,10 @@ module.exports = function(grunt) {
files: [{
expand: true,
cwd: 'example/source',
- src: ['*.svg', '*.png']
+ src: ['*.svg', '*.png'],
+ dest: "example/output"
}],
options: {
- // required config
- src: "example/source/",
- dest: "example/output/",
// optional grunticon config properties
// SVGO compression, false is the default, true will make it so
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "grunt-grunticon",
"description": "A mystical CSS icon solution",
- "version": "1.0.0-alpha.1",
+ "version": "1.0.0-alpha.2",
"homepage": "https://github.com/filamentgroup/grunticon",
"author": {
"name": "Scott Jehl",
View
19 tasks/grunticon.js
@@ -52,23 +52,20 @@ module.exports = function( grunt , undefined ) {
// just a quick starting message
grunt.log.writeln( "Look, it's a grunticon!" );
- // fail if config or no src or dest config
- if( !config || config.src === undefined || config.dest === undefined ){
- grunt.fatal( "Oops! Please provide grunticon configuration for src and dest in your grunt.js file" );
- done( false );
- }
-
- var files = this.files.map( function( file ){
- return file.src[0];
- });
- files = files.filter( function( file ){
- return file.match( /png|svg/ );
+ var files = this.files.filter( function( file ){
+ return file.src[0].match( /png|svg/ );
});
if( files.length === 0 ){
grunt.log.writeln( "Grunticon has no files to read!" );
done();
}
+ files = files.map( function( file ){
+ return file.src[0];
+ });
+
+ config.src = this.files[0].orig.cwd;
+ config.dest = this.files[0].orig.dest;
// folder name (within the output folder) for generated png files
var pngfolder = path.join.apply( null, config.pngfolder.split( path.sep ) );

0 comments on commit 239e19b

Please sign in to comment.