From 392ff15ee1d6a42620063ed6f5a0c4ca9ef14dbf Mon Sep 17 00:00:00 2001 From: Mikael Selander Date: Thu, 7 Feb 2013 13:56:35 +0100 Subject: [PATCH 1/2] Added replace capability to the wrap-injector. Removed test/actual-files. Those should not have been checked in. --- Gruntfile.coffee | 20 ++++++++++++++++++-- README.md | 11 +++++++++-- package.json | 6 +++--- tasks/template.coffee | 15 ++++++++++----- test/actual/concat.html | 3 --- test/actual/main.html | 3 --- test/actual/wrapped.html | 5 ----- test/actual/wrappedAdv.html | 5 ----- test/actual/wrappedConcat.html | 7 ------- test/expected/wrappedReplace.html | 5 +++++ test/template-test.coffee | 8 ++++++++ 11 files changed, 53 insertions(+), 35 deletions(-) delete mode 100644 test/actual/concat.html delete mode 100644 test/actual/main.html delete mode 100644 test/actual/wrapped.html delete mode 100644 test/actual/wrappedAdv.html delete mode 100644 test/actual/wrappedConcat.html create mode 100644 test/expected/wrappedReplace.html diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 056f306..ea1a5e0 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -68,6 +68,22 @@ module.exports = (grunt) -> prop: 'dest' rem: 'test/' }] + advWrapReplace: + files: + 'test/actual/wrappedReplace.html': 'test/source/main.template' + options: + data: + message: 'WrapReplace' + class: 'foo' + wrap: + banner: '\n' + footer: '\n' + inject: [{ + prop: 'src' + rem: 'test/' + repl: + ".template": ".html" + }] coffeelintOptions: @@ -101,7 +117,7 @@ module.exports = (grunt) -> grunt.registerTask 'mocha', 'run mocha', () -> done = grunt.task.current.async() require('child_process').exec( - 'mocha --compilers coffee:coffee-script -R nyan' + 'mocha --compilers coffee:coffee-script -R spec' , (err, stdout) -> grunt.log.write stdout done err @@ -112,5 +128,5 @@ module.exports = (grunt) -> 'coffeelint' 'template' 'mocha' - + 'clean' ] \ No newline at end of file diff --git a/README.md b/README.md index 21dc3a1..f1d8492 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,11 @@ Wrap the template with a banner and footer. Type: `Object` Default: `{}` -It is possible to inject file-path related data into the banner or footer of the wrapper. This is useful if you're wrapping your template with a script-tag, such as `', footer: '', inject: [{ - prop: 'src' - }, { - prop: 'dest', - rem: '/unwanted/path', - repl: { - ".wrongExtension": ".rightExtension" + prop: 'src' + }, { + prop: 'dest', + rem: '/unwanted/path', + repl: { + ".wrongExtension": ".rightExtension" } }] }