Skip to content

Webpack plugin for creating a file with static or dynamic content

License

Notifications You must be signed in to change notification settings

scratchpad-ai/create-file-webpack-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create-file-webpack-plugin

Webpack plugin for creating a file with static or dynamic content

Install

$ npm install create-file-webpack-plugin --save-dev

Usage

const CreateFilePlugin = require('create-file-webpack-plugin');

module.exports = {
	// …
	plugins: [
		new CreateFilePlugin('file.js', `
			console.log('This is a dynamically created file');
		`)
	]
};

API

CreateFilePlugin({filePath, fileName, content})

filePath

Type: string

Relative path to where the file should be created

fileName

Type: string

Name of file to be created

content

Type: string | (({filePath, fileName, compilation}) => string)

File content or a function that returns the file content.

If a function, it will receive an object with the following data filePath, fileName and compilation instance.

License

MIT © Ricard Fredin

About

Webpack plugin for creating a file with static or dynamic content

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%