Skip to content

Instantly share code, notes, and snippets.

@lgandecki
Created September 20, 2017 07:36
Show Gist options
  • Save lgandecki/41624e804ac631edb7e1ec373e61efa3 to your computer and use it in GitHub Desktop.
Save lgandecki/41624e804ac631edb7e1ec373e61efa3 to your computer and use it in GitHub Desktop.
remove importing html plugin
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (_ref) {
var t = _ref.types;
return {
visitor: {
ImportDeclaration: {
exit: function exit(path, state) {
var node = path.node;
if (endsWith(node.source.value, '.html')) {
console.log("inside here");
console.log("Gandecki node.specifiers[0]", node.specifiers);
}
if (endsWith(node.source.value, '.html')) {
path.remove();
}
}
}
}
};
};
var _fs = require('fs');
var _fs2 = _interopRequireDefault(_fs);
var _path = require('path');
var _path2 = _interopRequireDefault(_path);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function endsWith(str, search) {
return str.indexOf(search, str.length - search.length) !== -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment