handlebars-faker-loader
v1.0.4
Published
A webpack plugin for handlebars and fakers JSON
Downloads
2
Readme
Handlebars faker loader
This is an special webpack loader for handlebars
How to use
yarn add --dev handlebars-faker-loader handlebars
{
test: /(\.faker\.js|\.handlebars)$/,
use: [
{
loader: 'file-loader',
options: {
name(file) {
let finalName = /[\d\w_]+(\.faker\.js|\.handlebars)$/i.exec(file)[0].replace('.handlebars','.html').replace('.faker.js','.html')
return finalName;
}
}
},
{
loader:'handlebars-faker-loader',
options: {
fakersDir:path.resolve(__dirname, 'src/fakers/'),
viewsDir:path.resolve(__dirname, 'src/views/'),
doNothing: true //(Optinal) If you dont want the puglin to act for some reason,
}
}
]
}
Faker example
module.exports =()=>{
return {
lorem:'mama mia '
};
}
You have to name the file with the extension .faker.js
,
and the handlebars with the extension .handlebars