html2jsfile
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "html2jsfile", | ||
"description": "The best Grunt plugin ever.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/imbolo/html2jsfile", | ||
@@ -45,2 +45,2 @@ "author": { | ||
] | ||
} | ||
} |
/* | ||
* html2js | ||
* https://github.com/liuyang/libs | ||
* https://github.com/imbolo/html2jsfile | ||
* | ||
@@ -15,3 +15,8 @@ * Copyright (c) 2014 liuyang | ||
// creation: http://gruntjs.com/creating-tasks | ||
var template = { | ||
amd:[ | ||
"define(function() {\nvar html = {};\n", | ||
"\nreturn html;\n});" | ||
] | ||
}; | ||
grunt.registerMultiTask('html2js', 'The best Grunt plugin ever.', function() { | ||
@@ -31,3 +36,3 @@ // Merge task-specific and/or target-specific options with these defaults. | ||
//head | ||
src += "define(function() {\nvar html = {};\n" | ||
src += template["amd"][0]; | ||
@@ -47,4 +52,5 @@ //body | ||
var result, key, arr, | ||
html = grunt.file.read(filepath).replace(/\\s*|\t|\r|\n/g, ""); | ||
html = grunt.file.read(filepath).replace(/'/g,"\""); | ||
html = html.replace(/\\s*|\t|\r|\n/g, ""); | ||
key = filepath; | ||
@@ -60,3 +66,3 @@ arr = key.split("/"); | ||
//foot | ||
src += "\nreturn html;\n});" | ||
src += template["amd"][1]; | ||
@@ -63,0 +69,0 @@ |
10037
164