1.1.0 • Published 9 years ago
file2ify v1.1.0
This is a simple loader for browserify, like file-loader for webpack.
file2ify is extending features as much as possible like file-loader.
E.g:
var tpl = require('./tpl.html');
var obj = {
hello : 'hello'
}
tpl.replace(/\$\{test\}/g, obj.hello);It's to require a html file, rendering in js file.
Setup:
npm install file2ify --productionuse like :
bundle.transform( file2ify, {
extension : ['html', 'css', 'json'] //be able to require file's type
} ).or:
"browserify": {
"transform": [
["file2ify", { "extension" : ['html', 'css', 'json'] }]
]
}examples :
npm run exampleImportant:
1, It's updating now, so can be able to require file's type is html, css, json.
2, css return String.