index.js 474 B

12345678910111213141516171819
  1. //modified https://github.com/grieve/webpack-glsl-loader/blob/master/index.js
  2. 'use strict';
  3. var fs = require('fs');
  4. var path = require('path');
  5. let parser = require('./parser')
  6. module.exports = function (source) {
  7. this.cacheable();
  8. var cb = this.async();
  9. parser(this, source, this.context, function (err, bld) {
  10. if (err) {
  11. return cb(err);
  12. }
  13. cb(null, 'module.exports = ' + JSON.stringify(bld));
  14. });
  15. };