Skip to content

sabberworm/babel-plugin-yui-compressor-fix-reserved-keywords

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-yui-compressor-fix-reserved-keywords

Babel plugin to automatically rename/fixup variable names, accessors and property names, and statements that trigger YUI compressor bugs.

Note: it will not fixup stuff that is too new for YUI compressor to know about so you should add it late to your list of plugins. Also if Babel decides you need its helpers, it will add those imports and exports after any plugins are run, it seems there is no way of fixing up those via a plug-in. If your project uses babel helpers, you need a second babel step which only runs this plug-in on the generated output.

Example

In

var short = function char() {
	debugger;
	return {
		default: 'yes'
	}.default;
}();

Out

var _short = function _char() {
	return {
		'default': 'yes'
	}['default'];
}();

Installation

$ npm install babel-plugin-yui-compressor-fix-reserved-keywords

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["yui-compressor-fix-reserved-keywords"]
}

Via CLI

$ babel --plugins yui-compressor-fix-reserved-keywords script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["yui-compressor-fix-reserved-keywords"]
});

About

Babel plugin to automatically rename/fixup variable names, accessors and property names, and statements that trigger YUI compressor bugs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published