Registry / http-networking / gulp-polymin2

gulp-polymin2

JSON →
library1.0.2jsnpmunverified

A Gulp plugin to optimize Polymer 2 components by minifying HTML, JavaScript, and CSS. It uses Babel for JS transpilation (with presets like 'babili' or 'es2015'), cssclean for CSS minification, and integrates uglify-js for JS minification. Current stable version is 1.0.2. Release cadence is low; last update was around 2017. Useful for legacy Polymer 2 builds but no longer actively maintained.

npm install gulp-polymin2
INSTALL
IMPORT
SIG · GULP-POLYMIN2
G
gulp-polymin2
http-networkingjavascriptv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

polymin
✓ var polymin = require('gulp-polymin2');
✗ import polymin from 'gulp-polymin2';
CommonJS require; ESM import not supported.
polymin (default)
✓ const polymin = require('gulp-polymin2');
✗ const { polimin } = require('gulp-polymin2');
Default export only, not named.
gulp.pipe
✓ .pipe(polymin(options))
✗ .pipe(new polymin(options))
polymin is a function returning a transform stream, not a constructor.

This shows how to set up a Gulp task that uses gulp-polymin2 to optimize Polymer 2 HTML components.

var gulp = require('gulp'); var polymin = require('gulp-polymin2'); gulp.task('compress', function() { return gulp.src('src/*.html') .pipe(polymin({ babelPressets: 'es2015', cssOptions: {}, jsOptions: null })) .pipe(gulp.dest('dist')); });
Debug
Known issues
deprecatedPackage is deprecated; no longer maintained. Use modern tools like polymer-build or webpack.
fix
Migrate to polymer-cli or @polymer/build.
affects: *
gotchaOption name 'babelPressets' is misspelled (should be 'babelPresets'). Using 'babelPressets' will be ignored.
fix
Use correct option: { babelPresets: 'es2015' }.
affects: <=1.0.2
gotchaIf jsOptions is null, uglify-js is not applied. Some expect minification by default.
fix
Explicitly set jsOptions to {} to enable uglify with defaults.
affects: *
breakingRequires Babel 6; incompatible with Babel 7+.
fix
Use babel-core@^6.0.0 or switch to a modern tool.
affects: >=1.0.0 <2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'cssclean'
cssclean is not included as a dependency of gulp-polymin2.
fix
Install cssclean separately: npm install --save-dev cssclean.
TypeError: polymin is not a function
Using default import syntax (ESM) with CommonJS module.
fix
Use require: var polymin = require('gulp-polymin2');
gulp-polymin2: option 'babelPressets' not recognized
Misspelled option name; actual is 'babelPresets'.
fix
Use babelPresets instead of babelPressets.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
gulprequiredpeer dependency for Gulp plugin
through2requiredstream transformation
csscleanrequiredCSS minification
babel-corerequiredJavaScript transpilation
uglify-jsoptionalJavaScript minification
Agent activity
10 hits · last 30 days
node
10
Resources
gulp-polymin2 — npm install gulp-polymin2 · libregistry