Skip to content

alex-lenk/template-structure-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Template Structure Generator

Easily scan your project directories to generate a structured list of your templates and their associated assets.

Installation

npm install template-structure-generator --save-dev

Usage

Simply integrate the plugin into your Webpack configuration. Specify the directory with the required file extensions and provide a template structure for the output.

const TemplateStructureGeneratorPlugin = require('template-structure-generator');

module.exports = {
  plugins: [
    new TemplateStructureGeneratorPlugin({
      directoryGlob: 'src/pages/*.html',
      outputDirectory: '.template-structure',
      outputFileName: 'templateList.js',
      template: {
        js: ['common.js'],
        scss: ['common.scss'],
      },
    }),
  ],
};

How it works

Upon execution, the script will traverse the specified directory and generate an output of all discovered templates, adhering to the provided structure:

Output example (./.template-structure/templateList.js):

module.exports = {
  'index.html': {
    js: ['common.js'],
    scss: ['common.scss'],
  },
  'detail.html': {
    js: ['common.js'],
    scss: ['common.scss'],
  },
};

Contribution

Feel free to submit issues or pull requests if you find any bugs or have suggestions for improvements.

About

Scans for page names and saves them.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published