How to “require” text files with browserify?

前端 未结 3 793
旧巷少年郎
旧巷少年郎 2021-02-02 11:19

I am using browserify (using browserify-middleware) how can I require simple text files, something like:

var myTmpl = require(\"myTmpl.txt\");

3条回答
  •  隐瞒了意图╮
    2021-02-02 11:47

    stringify:

    https://github.com/JohnPostlethwait/stringify

    Here's author example:

    var bundle = browserify()
        .transform(stringify(['.hjs', '.html', '.whatever']))
        .add('my_app_main.js');
    

提交回复
热议问题