8.0.0-rc.3 • Published 5 years ago

liferay-theme-es2015-hook v8.0.0-rc.3

Weekly downloads
43
License
ISC
Repository
-
Last release
5 years ago

Liferay Theme es2015 Hook

A hook for liferay-theme-tasks that allows for es2015 transpilation and AMD module configuration.

Install

Hook modules must be added as a dependency of a Liferay theme.

npm i --save liferay-theme-es2015-hook

After npm is done installing the dependency you must add the hook to the liferayTheme.hookModules property in your theme's package.json file.

{
  "name": "my-liferay-theme",
  "version": "1.0.0",
  "main": "package.json",
  "keywords": [
    "liferay-theme"
  ],
  "liferayTheme": {
    "baseTheme": "styled",
    "hookModules": ["liferay-theme-es2015-hook"],
    "rubySass": false,
    "templateLanguage": "ftl",
    "version": "7.0"
  },
  "devDependencies": {
    "gulp": "^3.8.10",
    "liferay-theme-tasks": "*",
    "liferay-theme-deps-7.0": "*"
  },
  "dependencies": {
    "liferay-theme-es2015-hook": "^1.0.0"
  }
}

Build

Now that the hook is installed, it will run with every gulp build and gulp:deploy.

To flag a file for es2015 transpilation and amd configuration you must simply use .es.js as the file extension. Files with just .js won't be transpiled.

Example

// my-liferay-theme/src/js/my_component.es.js

class MyComponent {
	constructor() {
		console.log('Hello, World!');
	}
}

export default MyComponent;

After building, my_component.es.js will be transpiled and packaged as an AMD module. This module can be loaded and implemented in your theme's main.js file.

// my-liferay-theme/src/js/main.js

require(
	'my-liferay-theme/js/my_component.es',
	function(MyComponent) {
		new MyComponent.default();
	}
);
8.0.0-rc.3

5 years ago

8.0.0-rc.2

5 years ago

8.0.0-rc.1

5 years ago

8.0.0-rc.0

5 years ago

8.0.0-beta.5

6 years ago

8.0.0-beta.4

6 years ago

8.0.0-beta.3

6 years ago

8.0.0-beta.2

6 years ago

8.0.0-beta.1

6 years ago

8.0.0-beta.0

6 years ago

8.0.0-alpha.6

6 years ago

8.0.0-alpha.5

6 years ago

7.0.0

6 years ago

8.0.0-alpha.4

6 years ago

8.0.0-alpha.3

6 years ago

8.0.0-alpha.2

6 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.1

8 years ago