
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
postcss-polymer-loader
Advanced tools
PostCSS Webpack loader for Polymer elements. Works in combination with the awesome wc-loader.
yarn add --dev postcss-polymer-loader
Add the postcss configuration file:
NOTE: you need to add these (or other) plugins as project dependencies.
module.exports = {
parser: 'sugarss',
plugins: {
'postcss-import': {},
'postcss-cssnext': {},
'autoprefixer': {},
'cssnano': {}
}
}
Add the loader to your webpack config:
module.exports = {
module: {
...
rules: [
...
{
test: /\.js$/,
use: ['babel-loader'] // For ES6 `import`
}, {
test: /\.html$/,
use: ['wc-loader', 'postcss-polymer-loader']
}
]
...
}
}
As stated, this loader needs an HTML loader and precisely the wc-loader to load Web Components. More specifically we are talking about Polymer elements.
NOTE: since the
wc-loaderworks well with the Polymer 2.x version, the example will be written in Polymer 2 sintax, but the loader should work also with Polymer 1.x.
|– src
| |– awesome-component
| | |– index.js
| | |- template.html
| | |- style.postcss
| |
| |- global-style.postcss
| |- main-entry.js
|
|– postcss.config.js
|– webpack.config.js
awesome-component/template.html (example)
<!-- This should be resolved by the `wc-loader` -->
<link rel="import" src="./path/to/polymer.html">
<dom-module id="awesome-component">
<postcss src="./../global-style.postcss"></postcss>
<postcss src="./style.postcss"></postcss>
<template>
<div class="TestDivOne"></div>
<div class="TestDivTwo"></div>
</template>
</dom-module>
awesome-component/index.js (example)
'use strict';
// import Polymer from 'polymer'; Aaaaaaaah if we could...!
import './template.html';
class AwesomeComponent extends Polymer.Element {
static get is() { return 'awesome-component' };
static get properties() {
return {
prop1: {
type: String,
value: 'This is awesome!'
}
}
};
};
window.customElements.define(AwesomeComponent.is, AwesomeComponent);
main-entry.js (example)
'use strict';
import './src/awesome-component';
This is currently a POC, so if you have some ideas or better solutions just open an issue and let's talk! :+1:
MIT © LasaleFamine
FAQs
PostCSS-Polymer loader for Webpack
We found that postcss-polymer-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.