directory-encoder
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -53,3 +53,11 @@ /*global require:true*/ | ||
// append each selector | ||
this.files.forEach(function( filepath ) { | ||
this.files.filter(function( filepath ){ | ||
var file = path.basename( filepath ), | ||
extension = path.extname( file ); | ||
return extension === ".svg" || extension === ".png"; | ||
}) | ||
.filter(function( filepath ){ | ||
return fs.lstatSync( filepath ).isFile(); | ||
}) | ||
.forEach(function( filepath ) { | ||
var css, datauri, stats, | ||
@@ -59,14 +67,10 @@ file = path.basename( filepath ), | ||
if( extension === ".svg" || extension === ".png" ) { | ||
if( fs.lstatSync( filepath ).isFile() ) { | ||
self._checkName(seen, file.replace( extension, '' )); | ||
self._checkName(seen, file.replace( extension, '' )); | ||
stats = self._stats( filepath ); | ||
datauri = self._datauri( filepath ); | ||
stats = self._stats( filepath ); | ||
datauri = self._datauri( filepath ); | ||
css = self._css( file.replace( extension, '' ), datauri, stats ); | ||
css = self._css( file.replace( extension, '' ), datauri, stats ); | ||
fs.appendFileSync( self.output, css + "\n\n" ); | ||
} | ||
} | ||
fs.appendFileSync( self.output, css + "\n\n" ); | ||
}); | ||
@@ -157,7 +161,9 @@ }; | ||
if( templateFile && fs.existsSync( templateFile ) && fs.lstatSync( templateFile ).isFile() ){ | ||
if( !templateFile ) { return false; } | ||
if( fs.existsSync( templateFile ) && fs.lstatSync( templateFile ).isFile() ){ | ||
var source = fs.readFileSync( templateFile ).toString( 'utf-8' ); | ||
tmpl = Handlebars.compile(source); | ||
} else { | ||
tmpl = false; | ||
throw new Error( "Template file either doesn't exist or isn't a file" ); | ||
} | ||
@@ -164,0 +170,0 @@ |
{ | ||
"name": "directory-encoder", | ||
"description": "Encode a directory of images to CSS", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"homepage": "https://github.com/filamentgroup/directory-encoder", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -152,2 +152,10 @@ /*global require:true*/ | ||
withTemplateError: function( test ) { | ||
test.expect(1); | ||
test.throws(function(){ | ||
new Constructor( "test/directory-files", "test/output/encoded2.css", | ||
{ template: path.resolve( "test/files/not-here.hbs" )} ); | ||
}); | ||
test.done(); | ||
}, | ||
withTemplate: function( test ) { | ||
@@ -154,0 +162,0 @@ test.equal( this.encoder2._css("foo", "bar"), |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35851
658