This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const postcss = require('postcss'); | |
const postcssrc = require('postcss-load-config'); | |
const deasyncPromise = require('deasync-promise'); | |
const expressionsRegex = /__QUASI_EXPR_(\d+)__/g; | |
const splitExpressions = (css) => { | |
let found; | |
const matches = []; | |
while ((found = expressionsRegex.exec(css)) !== null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Test</title> | |
<link rel="modulepreload" href="log.js"></link> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// const css = (code) => code; | |
// const style = css` | |
// p { color: red; } | |
// `; | |
// ----------------------------------------------------------------------------- | |
// const style = /* css */ ` | |
// p { color: red; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<style> | |
my-app::part(test-item) { | |
color: red; | |
font-size: 20px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<title>Document</title> | |
</head> | |
<body> | |
<my-app></my-app> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!process.env.ROLLUP_WATCH) process.env.BABEL_ENV = 'production'; | |
module.exports = { | |
presets: [ | |
[ | |
'@babel/env', | |
{ | |
modules: false, | |
targets: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
presets: [ | |
[ | |
'@babel/env', | |
{ | |
modules: false, | |
// loose: true, | |
targets: { | |
esmodules: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { readFile, writeFile } from 'fs'; | |
import postcssrc from 'postcss-load-config'; | |
import postcss from 'postcss'; | |
// export default (ctx = {}) => ({ | |
// name: 'postcss-in-css', | |
// buildEnd: () => | |
// readFile(ctx.from, (err, css) => | |
// postcssrc(ctx).then(({ plugins, options }) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const postcssLoadConfig = require('postcss-load-config'); | |
const postcss = require('postcss'); | |
const code = ``; | |
postcssLoadConfig().then(({ plugins, options }) => { | |
postcss(plugins) | |
.process(code, options) | |
.then(({ css }) => console.log(css)); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = ({ production }) => ({ | |
plugins: { | |
'postcss-preset-env': { | |
stage: 0, | |
features: { | |
'nesting-rules': {}, | |
}, | |
autoprefixer: production && { |