@muntrue/generateimports

Download on NPM

npm i @muntrue/generateimports

Package to generate import files with easy, currently supports:

  • Javascript ECMAScript 6 classes
  • File separated Vue components
  • Sass files

Package will scan folders for filetypes and add them to a predefined output file.


Properties

Module will accept an object with three properties

{
    files: [],      // Array with single files to include in the import list
    folders: [],    // Array with folders to scan trough, this scan is recursive.
    output: ""      // String with the filename where the output file will be stored.
}

Examples

ECMAScript6 class
const generator = require("@muntrue/generateimports");

generator.js({
   files:   ["vendor.js"],
   folders: ["resources/js", "additional/folders"],
   output:  "importsfile.js"
});
Vue components
const generator = require("@muntrue/generateimports");

generator.vue({
   folders: ["resources/vue-components", "additional/folders"],
   output:  "vue-importsfile.js"
});
Sass files
const generator = require("@muntrue/generateimports");

generator.scss({
   folders: ["resources/scss", "vendor/scss", "additional/folders"],
   output:  "vue-importsfile.js"
});