@userfrosting/gulp-bundle-assets
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-rc.1
@@ -10,3 +10,3 @@ # Changelog | ||
## [3.0.0-beta.1] - 2018-12-13 | ||
## [3.0.0-rc.1] - 2019-01-09 | ||
@@ -17,3 +17,3 @@ This release focuses on simplifying the package for UserFrosting 4 to improve maintainability. Features unsupported by UF4 are largely removed. | ||
- Raw configuration validation. | ||
- Raw configuration merging. | ||
- Raw configuration merging with collision logic (ported from UserFrosting `gulpfile`). | ||
- Path transformation with support for file replacement based on rule order (later rules superseed earlier ones). | ||
@@ -26,7 +26,6 @@ - Ability to specify base path for resolution of bundle resources and path transformations. | ||
- Reads stream chunks (`Vinyl` instances) instead of directly from file system. | ||
- As an internal `gulp` pipeline is no longer responsible for bundle generation, custom `Transform`s (e.g. `gulp-concat-css`) must be provided. | ||
- As an internal `gulp` pipeline is no longer responsible for bundle generation, custom `Transform` streams (e.g. `gulp-concat-css`) must be provided. | ||
- Path transformations will no longer be applied to files due to complexity around how paths are managed in `gulp`. Instead this feature will be used for override logic alone. | ||
- Removed `PathTransformsBasePath` as a possible configuration value. | ||
- Bundle results are now retrieved via a callback which is given a collection of `Vinyl` `NullFiles` to retain as much useful information as possible. | ||
- Moved package under `@UserFrosting` organisation in NPM and removed superfluous `uf` from package name. | ||
- Moved package under `@userfrosting` organisation in NPM and removed superfluous `uf` from package name. | ||
@@ -33,0 +32,0 @@ ### Removed |
@@ -17,3 +17,3 @@ import Extend from "just-extend"; | ||
// Prevent modification of input | ||
let nextConfig = Extend({}, config); | ||
let nextConfig = Extend(true, {}, config); | ||
// Merge all bundle definitions into nextConfig (to handle collision logic correctly) | ||
@@ -44,3 +44,3 @@ if (outConfig.bundle) { | ||
// Merge objects | ||
Extend(outConfig, nextConfig); | ||
Extend(true, outConfig, nextConfig); | ||
}); | ||
@@ -75,3 +75,3 @@ return outConfig; | ||
nextBundle.styles = [...new Set([...existingBundle.styles, ...nextBundle.styles])]; | ||
return Extend(existingBundle, nextBundle); | ||
return Extend(true, existingBundle, nextBundle); | ||
} | ||
@@ -78,0 +78,0 @@ // Ignore - Return existing bundle |
@@ -54,3 +54,3 @@ import Extend from "just-extend"; | ||
// Deep clone config object to prevent mutations from spilling out | ||
config = Extend({}, config); | ||
config = Extend(true, {}, config); | ||
// Extract virtual path (if set) and make canonical paths absolute | ||
@@ -57,0 +57,0 @@ if (config.VirtualPathRules) { |
{ | ||
"name": "@userfrosting/gulp-bundle-assets", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-rc.1", | ||
"description": "Fork of Chris Montgomery's gulp-bundle-assets, striped back and rewritten for use with UserFrosting.", | ||
@@ -53,3 +53,3 @@ "main": "./dist/index.js", | ||
"@types/vinyl": "^2.0.2", | ||
"ava": "^0.25.0", | ||
"ava": "^1.0.1", | ||
"changelog-updater": "^1.1.0", | ||
@@ -68,4 +68,5 @@ "typescript": "^3.1.6" | ||
"esm" | ||
] | ||
], | ||
"babel": false | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# [gulp](https://github.com/gulpjs/gulp)-uf-bundle-assets | ||
# [gulp](https://github.com/gulpjs/gulp)-bundle-assets | ||
@@ -13,3 +13,3 @@ | Branch | Status | | ||
```bash | ||
npm install gulp-uf-bundle-assets@alpha --save-dev | ||
npm install @userfrosting/gulp-bundle-assets --save-dev | ||
``` | ||
@@ -20,43 +20,50 @@ | ||
```js | ||
import Bundler from "gulp-uf-bundle-assets"; | ||
import Gulp from "gulp"; | ||
import CleanCss from "gulp-clean-css"; | ||
import ConcatCss from "gulp-concat-css"; | ||
import Uglify from "gulp-uglify"; | ||
import ConcatJs from "gulp-concat-js"; | ||
// gulpfile.esm.js | ||
import assetBundler from "@userfrosting/gulp-bundle-assets"; | ||
import { src, dest } from "gulp"; | ||
import cleanCss from "gulp-clean-css"; | ||
import concatCss from "gulp-concat-css"; | ||
import uglify from "gulp-uglify"; | ||
import concatJs from "gulp-concat-js"; | ||
const config = { | ||
bundle: { | ||
example: { | ||
scripts: [ | ||
"foo.js", | ||
"bar.js" | ||
], | ||
styles: [ | ||
"foo.css", | ||
"bar.css" | ||
] | ||
export function bundle() { | ||
const config = { | ||
bundle: { | ||
example: { | ||
scripts: [ | ||
"foo.js", | ||
"bar.js" | ||
], | ||
styles: [ | ||
"foo.css", | ||
"bar.css" | ||
] | ||
} | ||
} | ||
} | ||
}; | ||
const joiner = { | ||
Scripts = function(src, name) { | ||
return src | ||
.pipe(ConcatJs(name + ".js")) | ||
.pipe(Uglify()); | ||
}, | ||
Styles = function(src, name) { | ||
return src | ||
.pipe(ConcatCss(name + ".css")) | ||
.pipe(CleanCss({ | ||
compatibility: "ie10" | ||
})); | ||
} | ||
}; | ||
}; | ||
const joiner = { | ||
Scripts = function(bundleStream, name) { | ||
return bundleStream | ||
.pipe(concatJs(name + ".js"))// example.js | ||
.pipe(uglify()); | ||
}, | ||
Styles = function(bundleStream, name) { | ||
return bundleStream | ||
.pipe(concatCss(name + ".css"))// example.css | ||
.pipe(cleanCss({ | ||
compatibility: "ie10" | ||
})); | ||
} | ||
}; | ||
Gulp.src(inputGlob) | ||
.pipe(Bundler(config, joiner)) | ||
.pipe(Gulp.dest(outputDir)); | ||
return src("src/**") | ||
.pipe(assetBundler(config, joiner)) | ||
.pipe(dest("public/assets/")); | ||
} | ||
``` | ||
```bash | ||
$ gulp bundle | ||
``` | ||
## Integrating bundles into your app | ||
@@ -68,2 +75,6 @@ | ||
## API | ||
Generation of API documentation is not yet implemented however the API surface is fully documented interally. Use VS Code or look at the source on GitHub in the meantime. | ||
## History | ||
@@ -75,2 +86,4 @@ | ||
This package was previously published under `gulp-uf-bundle-assets` and as of v3 is published under `@userfrosting/gulp-bundle-assets` to assist in longterm project management. | ||
## Release process | ||
@@ -77,0 +90,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48240
97