Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use autoprefixer, babel with this tool? #2138

Closed
SPAHI4 opened this issue Jun 6, 2016 · 12 comments
Closed

How to use autoprefixer, babel with this tool? #2138

SPAHI4 opened this issue Jun 6, 2016 · 12 comments

Comments

@SPAHI4
Copy link

SPAHI4 commented Jun 6, 2016

es6 is really awesome and i cant imagine back to old js

@SPAHI4 SPAHI4 changed the title How to use autoprefixer, babel with this? How to use autoprefixer, babel with this tool? Jun 8, 2016
@justinfagnani
Copy link
Contributor

We're working on making the internal steps of the build pipeline available to import into a gulefile, where you can plug in any other compilers or processors that you want. I'll update this issue with the tracking issue for that work.

@mickeywu
Copy link

@justinfagnani Any updates for the build pipeline plugin feature? Thanks!

@FredKSchott
Copy link
Contributor

@mickeywu yup! The build pipeline now exists in a standalone library: https://github.com/Polymer/polymer-build.

polymer-cli now uses a basic polymer-build pipeline for its build process. To modify/create your own build pipeline (one that runs babel on each JS file, for example) try using polymer-build yourself in a gulp task (or equivilent).

@davidsteinberger
Copy link

@FredKSchott really interested in this as well. are there any examples out there that show how that'd b e done with polymer-build?

@FredKSchott
Copy link
Contributor

@davidsteinberger I'm going to be fleshing out on the repo's README early next week, but for now check out how both the CLI & polymer-starter-kit are being moved over to it.

@davidsteinberger
Copy link

Thanks! It's actually pretty clear for me how I'd do it in the starter-kit (b/c I can directly update the gulpfile), however I do not understand how the cli exposes the build-pipeline.

@FredKSchott
Copy link
Contributor

Polymer CLI will remain focused on the CLI use case, so for now we have no plans to expose polymer-build or the build-pipeline directly from it.

Polymer CLI's "build" goals will be to serve beginning users and intermediate/advanced users who just need its basic pipeline. This will include some common customization and configuration options via command line flags and arguments (ex: include additional files, include service worker, etc).

For more advanced customization (ex: user defined file transformations, multiple builds, etc) we recommend using the polymer-build library to define your own, custom build pipeline in your own project. This is what polymer-starter-kit is doing.

I'll be working on that README this week to explain this, but would love any feedback you have now. Maybe a blog post digging into this a little deeper would help?

@davidsteinberger
Copy link

Have been ooo for a few days. I had a look onto the PSK2 branch. The hooks in polymer-build will make it easy to run babel and transpile ES6. However I'm still unclear how to use ES6 modules. Using browserify and bundling everything kinda defeats the advantage that lazy-loading w/ importHref provides. Any thoughts on how to bridge the gap between HTML imports and ES6 modules?

@dandv
Copy link

dandv commented Sep 26, 2016

@FredKSchott:

I'm going to be fleshing out on the repo's README early next week, but for now check out how both the CLI & polymer-starter-kit are being moved over to it

Any updates? The README doesn't mention ES6/ES2015, and PSK doesn't use gulpfile.js any more.

@FredKSchott
Copy link
Contributor

Check out https://github.com/PolymerElements/generator-polymer-init-custom-build for an example of a project built with polymer-build. It doesn't use babel, but you could imagine hooking babel into that pipeline (polymer-build is built on vinyl streams, which means it will work with most gulp plugins.

@mgibas
Copy link

mgibas commented Nov 17, 2017

I didn't like idea of switching to custom build, just for this so, I just added npm run autoprefixer to my build script.

package.json:

  "scripts": {
    "autoprefixer": "postcss ./src/**/*.html --replace --use autoprefixer -s postcss-html --no-map"
  }

and of course necessary packages:
npm install --save-dev postcss-cli postcss-html autoprefixer

@admwx7
Copy link
Contributor

admwx7 commented Feb 2, 2018

This is my "build process" (package.json):

"devDependencies": {
    "autoprefixer": "^7.2.5",
    "polymer-cli": "^1.5.7",
    "postcss-cli": "^4.1.1",
    "postcss-html": "^0.12.0"
},
"scripts": {
    "autoprefixer": "postcss \"build/**/*.html\" -r -u autoprefixer -s postcss-html --no-map",
    "build": "polymer build && npm run autoprefixer"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants