Skip to content

VladimirMikulic/parcel-plugin-custom-dist-structure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

parcel-plugin-custom-dist-structure

Version Downloads License: MIT Twitter: VladoDev

πŸš€ Parcel plugin that allows you to specify a custom dist structure.

This is the plugin for Parcel v1. @gatsbyjs/parcel-namer-relative-to-cwd can be used for Parcel v2.

πŸ“¦ Installation

# Installs the plugin and saves it as a development dependency
npm i parcel-plugin-custom-dist-structure --save-dev

☁️ Usage

After you've installed the plugin, you'll need to specify configuration for it in package.json.

The plugin configuration is very simple, but also very flexible.

It will generate the structure you specify in the configuration object while also handle all your imports (css, images, js...) which makes it suitable for all use cases, from simple websites all the way to complex React/Angular/Vue projects.

Example configuration object in package.json:

"customDistStructure": {
  "config": {
    // Output JS files to dist/js folder
    ".js": "js",
    // Output JPG and PNG files to dist/images folder
    "images": [
      ".jpg",
      ".png"
    ],
    // General idea
    ".fileExtension": "folder/in/dist",
    "folder/in/dist": [ ".file", ".extensions" ]
  },
  "options": {
    // Enable plugin in development mode (default: false)
    "development": true
  }
}

⚠️ NOTE: In order for this plugin to work, Parcel needs to be installed as a project dependency (globally installed parcel won't work)

✨ Run tests

The plugin uses Jest for running tests.

Jest will execute all .test.js files in the test folder.

npm test

πŸ‘¨ Author

Vladimir Mikulic

🀝 Contributing

Contributions, issues and feature requests are welcome!

πŸ“ License

This project is licensed under MIT license.

πŸ‘¨β€πŸš€ Show your support

Give a ⭐️ if this project helped you!