webpack-concat-plugin

WebJar for webpack-concat-plugin

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

webpack-concat-plugin
Last Version

Last Version

1.4.0
Release Date

Release Date

Type

Type

jar
Description

Description

webpack-concat-plugin
WebJar for webpack-concat-plugin
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/hxlniada/webpack-concat-plugin

Download webpack-concat-plugin

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/webpack-concat-plugin/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>webpack-concat-plugin</artifactId>
    <version>1.4.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/webpack-concat-plugin/
implementation 'org.webjars.npm:webpack-concat-plugin:1.4.0'
// https://jarcasting.com/artifacts/org.webjars.npm/webpack-concat-plugin/
implementation ("org.webjars.npm:webpack-concat-plugin:1.4.0")
'org.webjars.npm:webpack-concat-plugin:jar:1.4.0'
<dependency org="org.webjars.npm" name="webpack-concat-plugin" rev="1.4.0">
  <artifact name="webpack-concat-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='webpack-concat-plugin', version='1.4.0')
)
libraryDependencies += "org.webjars.npm" % "webpack-concat-plugin" % "1.4.0"
[org.webjars.npm/webpack-concat-plugin "1.4.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : md5 jar [2.2.1,3)
org.webjars.npm : uglify-js jar [2.8.29,3)

Project Modules

There are no modules declared in this project.

webpack-concat-plugin

Build Status npm package npm downloads

A plugin to help webpack concat js and inject into html

Why

Webpack is really powerful. However, when I want to concat the static files and inject into html without webpack JSONP code wrapper, it seems impossible to do that without other tool's help.

Install

npm install webpack-concat-plugin --save-dev

for webpack >= 4.0

npm install [email protected] --save-dev

Features

  • Concat
  • Inject to html(with html-webpack-plugin)

Usage

const ConcatPlugin = require('webpack-concat-plugin');

new ConcatPlugin({
    ...see options
    // examples
    uglify: false,
    sourceMap: false,
    name: 'result',
    outputPath: 'path/to/output/',
    fileName: '[name].[hash:8].js',
    filesToConcat: ['jquery', './src/lib/**', './dep/dep.js', ['./some/**', '!./some/excludes/**']],
    attributes: {
        async: true
    }
});

Options

uglify [boolean | object] default: false

if true the output file will be uglified

or set uglifyjs options to customize the output

sourceMap [boolean] default: false

if true, will output sourcemap

name [string] default: "result"

it's useful when you want to inject to html-webpack-plugin manully

publicPath [string|boolean] default: webpack's publicPath

if set, will be used as the public path of the script tag.

if set to false, will use relativePath.

outputPath [string]

if set, will be used as the output directory of the file.

fileName [string] default: [name].js

if set, will be used as the output fileName

filesToConcat [array] required

supported path patterns:

  • normal path
  • npm packages
  • glob

injectType ["prepend"|"append"|"none"] default: "prepend"

how to auto inject to html-webpack-plugin(only if html-webpack-plugin set inject option not to be false)

attributes [object]

if set, will be used as the extra attributes of the script tag.

Examples

Inject to html by hand

doctype html
...
    script(src=htmlWebpackPlugin.files.webpackConcat.flexible)
...

TODO

  • add css support
  • auto inject to html

Versions

Version
1.4.0