grunt-img2sassb64
Advanced tools
Comparing version
@@ -61,2 +61,10 @@ /* | ||
} | ||
}, | ||
multi_file_atsign_test: { | ||
options: { | ||
replaceAtSign: "AT" | ||
}, | ||
files: { | ||
'tmp/multi_file_atsign_scss': ['test/fixtures/*.png', 'test/fixtures/*.jpg', 'test/fixtures/*.gif', 'test/fixtures_2/*.jpg'] | ||
} | ||
} | ||
@@ -63,0 +71,0 @@ }, |
{ | ||
"name": "grunt-img2sassb64", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Converts image files to Base64 and saves them as SCSS or SASS variables in a single file", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/sarweiler/img2sassb64", |
@@ -53,3 +53,9 @@ # img2sassb64 | ||
#### options.replaceAtSign | ||
Type: `String` | ||
Default value: `_` | ||
Set a string to replace `@` in file names with. For example `img@2x.jpg` will be stored in a variable named `$img_2x_jpg` when using the default. | ||
### Usage Examples | ||
@@ -79,8 +85,9 @@ | ||
options: { | ||
sassSyntax: true | ||
sassSyntax: true, | ||
replaceAtSign: 'AT' | ||
}, | ||
files: { | ||
'dest/_icons.scss': ['images/icons/*.png', 'images/more_icons/*.gif', 'images/more_icons/*.jpg'], | ||
}, | ||
}, | ||
} | ||
} | ||
}) | ||
@@ -91,2 +98,3 @@ ``` | ||
* 0.1.3 Added option to replace @ with string in file name (default: "_") | ||
* 0.1.2 Fixed missing quotes in generated output | ||
@@ -93,0 +101,0 @@ * 0.1.1 Updated documentation |
@@ -20,3 +20,4 @@ /* | ||
var options = this.options({ | ||
sassSyntax: false | ||
sassSyntax: false, | ||
replaceAtSign: "_" | ||
}); | ||
@@ -54,3 +55,3 @@ | ||
var varName = '$' + fileName.replace(/\./, '_'); | ||
var varName = '$' + fileName.replace(/\./, '_').replace(/@/, options.replaceAtSign); | ||
var matchFileExtension = fileName.match(/.*\.(.+)$/); | ||
@@ -57,0 +58,0 @@ |
@@ -65,3 +65,12 @@ 'use strict'; | ||
test.done(); | ||
}, | ||
multi_file_atsign_test: function (test) { | ||
test.expect(1); | ||
var actual = grunt.file.read('tmp/multi_file_atsign_scss'); | ||
var expected = grunt.file.read('test/expected/multi_file_atsign_scss'); | ||
test.equal(actual, expected, 'should generate a SCSS file with multiple files and file formats and replace the "@" in the file name with "AT".'); | ||
test.done(); | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
13710
11.51%19
11.76%203
8.56%108
8%