Comparing version 0.1.1 to 0.1.2
@@ -0,1 +1,3 @@ | ||
v0.1.2 | ||
Added option to name compiled function | ||
v0.1.1 | ||
@@ -2,0 +4,0 @@ Use of initial compile options |
@@ -78,2 +78,9 @@ /* | ||
} | ||
}, | ||
named_function: { | ||
src: 'test/fixtures/qux/foo.xml', | ||
dest: 'test/tmp/named/foo.js', | ||
options: { | ||
name: 'foo' | ||
} | ||
} | ||
@@ -80,0 +87,0 @@ }, |
{ | ||
"name": "grunt-fest", | ||
"description": "Compile Fest templates", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/eprev/grunt-fest", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -65,2 +65,9 @@ # grunt-fest [![Build Status](https://travis-ci.org/eprev/grunt-fest.png)](https://travis-ci.org/eprev/grunt-fest) | ||
#### options.name | ||
Type: `String` | ||
Default value: `undefined` | ||
Compiled function’s name. | ||
#### options.template | ||
@@ -93,6 +100,10 @@ | ||
}, | ||
put_in_the_same_derictory: { // Compiles "fest/**/*.xml" to "fest/**/*.js" | ||
// Compiles "fest/**/*.xml" to "fest/**/*.js" | ||
put_in_the_same_derictory: { | ||
src: 'fest/**/*.xml' | ||
}, | ||
put_in_the_same_derictory_and_append_ext: { // Compiles "fest/**/*.xml" to "fest/**/*.xml.js" | ||
// Compiles "fest/**/*.xml" to "fest/**/*.xml.js" | ||
put_in_the_same_derictory_and_append_ext: { | ||
src: 'fest/**/*.xml', | ||
@@ -103,3 +114,14 @@ options: { | ||
}, | ||
'build': ['fest/**/*.xml'] // Compiles "test/**/*.xml" to "build/fest/**/*.js" | ||
// Compiles "test/**/*.xml" to "build/fest/**/*.js", | ||
'build': ['fest/**/*.xml'], | ||
// Compiles "test/qux.xml" to named function and writes it to "build/qux.js" | ||
v8: { | ||
src: 'fest/qux.xml', | ||
dest 'build/qux.js', | ||
options: { | ||
name: 'qux' | ||
} | ||
} | ||
} | ||
@@ -154,3 +176,3 @@ }) | ||
return grunt.template.process( | ||
'define(<%= JSON.stringify(name + ".js") %>, function () { return <%= contents %> ; });', | ||
'define(<%= JSON.stringify(name) %>, function () { return <%= contents %> ; });', | ||
{data: data} | ||
@@ -157,0 +179,0 @@ ); |
@@ -38,5 +38,11 @@ /* | ||
if (f.orig.expand) { | ||
// dynamic mapping | ||
dest = f.dest; | ||
relSrc = f.orig.cwd ? relative(f.orig.cwd, src) : src; | ||
} else if (f.orig.src.length === 1 && grunt.file.isFile(f.orig.src[0])) { | ||
// file to file mapping | ||
dest = f.dest; | ||
relSrc = src; | ||
} else { | ||
// files to directory mapping | ||
dest = f.dest ? join(f.dest, src) : src; | ||
@@ -52,3 +58,3 @@ relSrc = src; | ||
try { | ||
contents = compile(src, extend({}, options.compile)); | ||
contents = compile(src, extend({}, options.compile), options.name); | ||
} catch (e) { | ||
@@ -55,0 +61,0 @@ grunt.log.writeln(); |
@@ -69,3 +69,11 @@ 'use strict'; | ||
test.done(); | ||
}, | ||
named_function: function (test) { | ||
['foo'].forEach(function (tpl) { | ||
var actual = grunt.file.read('test/tmp/named/' + tpl + '.js'); | ||
var expected = grunt.file.read('test/expected/tmp/named/' + tpl + '.js'); | ||
test.equal(actual, expected); | ||
}); | ||
test.done(); | ||
} | ||
}; |
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
61867
25
1388
194