webpub v0.1.7
webpub
An easy to use processor for processing web static files. Static asset revisioning, compressing and preprocessing.
Processor
webpub currently supports 'uglify' | 'autoprefixer' | 'clean-css' | 'revision'.
Get started
You should bundle your typescript, scss and modules with webpack.
webpub is a tool for processing your static files before publishing to server.
Installation
npm install webpub -g
or with yarn:
yarn global add webpub
Usage
Create webpub.json
in your project's directory:
{
"outputDir": "release",
"staticFiles": "src/public/**/*",
"include": [
"src/public/**/*"
],
"dontRenameExtension": [
"html",
"hbs"
],
"clean": true
}
And then run: webpub
. done.
Options
outputDir (Required)
Type: string
The output directory. Must be relative path of your project.
staticFiles (Required)
Type: string | string[] | object
Specifies a list of glob patterns that match files to be processing in webpub.
Note that your html template must be included in staticFiles
otherwise the reference will not be updated.
If you have multiple static directories, you can set staticFiles
with object value like:
{
"staticFiles": {
"/dist/": "dist/*",
"/": "src/public/**/*"
}
}
The key is url prefix. The value is glob pattern of your static files.
include (Required)
Type: string | string[]
Specifies a list of glob patterns that match files to be included in publish package.
dontRenameExtension (Required)
Type: string | string[]
Don't rename files matching these extension. For example, you don't want to rename your template file, so you can add your template's extension.
clean (Required)
Type: boolean
By default webpub will not delete your outputDir
.
You should set clean
to true if you want webpub to delete outputDir
every time.
dontRenameFile
Type: string | string[]
Don't rename files matching these globs. Note that favicon.ico
will never be renamed.
manifest
Type: boolean
An asset manifest, mapping the original paths to the revisioned paths, will be written to outputDir/manifest.json
:
{
"dist/common.css": "dist/common.66a4ef0.css",
"src/public/images/favicon.png": "src/public/images/favicon.48d4f21.png"
}
tarball
Type: { [tarballName: string]: string | string[] }
Create tgz tarballs by glob files.
beforeTarball
Type: string | string[]
Run commands before tarball.
end
Type: string | string[]
Run commands before webpub exists.
hashLength
Type: number
Default: 6
Change the length of the hash appended to the end of each revisioned file.
debug
Type: boolean
Default: false
If you set this options to true, verbose logging will be emitted to console.
LICENSE
webpub is primarily distributed under the terms of the MIT license. See LICENSE for details.