Skip to content

generative-objects-org/GO-custom-file-concat-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Plugin description

This plugin is a GO-specific Webpack plugin, aimed at concatenating several JavaScript files, located in the options.filesDirectory folder into one "big" JS file, which path is given by options.targetFile.

It is basically the same as doing the following in a shell before running Webpack on the generated application.

cat "myDirectory/**.js" > "targetFile.js"

Configuration

The plugin must be imported in your Webpack config file:

const CustomFileConcatPlugin = require('go-custom-file-concat-webpack-plugin');

then can be added to the plugin list, with to optional options:

plugins: [
    new CustomFileConcatPlugin({
        filesDirectory: './src/custom/components/', // default value
        targetFile: './src/custom/index.js' // default value
    })
];

Compatibility with Webpack Dev server

This plugin is compatible with the Webpack dev server and hot reloading: it will detect changes (removals, additions, saves) in the filesDirectory and update the targetFile accordingly.

Usage in GO generated apps / custom code

In GO generated apps, a specific mixin is added to all generated components in order to let developpers add custom code to components if they want. This mixin does a

import * as Custom from './src/custom/index.js';

In that way, one can add any Custom module in the filesDirectory which will be concatenated into the targetFile and injected by the CustomCodeMixing, provided that the module has the same name as the component it is meant to extend.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published