grunt-require2string

require document as js string

Usage no npm install needed!

<script type="module">
  import gruntRequire2string from 'https://cdn.skypack.dev/grunt-require2string';
</script>

README

convert "require('filepath')" to js string

for exp. var a = require('../a.css') => var a = 'body{......}'

conf

req2str : {
    build : {
        expand: true,
        cwd : 'comp',
        src : ['./*/init.js'],
        dest : 'publish/'
    }
}