1.0.4 • Published 5 years ago

handlebars-faker-loader v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago