-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #241 from nvh95/postcss-support
PostCSS support
- Loading branch information
Showing
20 changed files
with
422 additions
and
95 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: ['./src/**/*.{html,ts}'], | ||
theme: { | ||
extend: {}, | ||
colors: { | ||
xanh: '#34eb4f', | ||
}, | ||
}, | ||
plugins: [], | ||
}; |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], | ||
theme: { | ||
extend: {}, | ||
colors: { | ||
xanh: '#34eb4f', | ||
}, | ||
}, | ||
plugins: [], | ||
}; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
a { | ||
color: aliceblue; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const { spawnSync } = require('child_process'); | ||
|
||
// const result = spawnSync('node', [ | ||
// '-e', | ||
// `const postcss = require('postcss'); | ||
// const postcssrc = require('postcss-load-config'); | ||
// const { readFileSync } = require('fs'); | ||
// const css = readFileSync('index.css', 'utf8'); | ||
|
||
// postcssrc().then(({ plugins, options }) => { | ||
// // console.log({ plugins, options }); | ||
|
||
// postcss(plugins) | ||
// .process(css, { ...options, from: 'index.css' }) | ||
// .then((result) => console.log(result.css)); | ||
// });`, | ||
// ]); | ||
// const stderr = result.stderr.toString('utf-8').trim(); | ||
// if (stderr) console.error(stderr); | ||
// if (result.error) throw result.error; | ||
// const a = result.stdout.toString(); | ||
// console.log(a); | ||
|
||
function havePostCss() { | ||
const result = spawnSync('node', [ | ||
'-e', | ||
`const postcssrc = require('postcss-load-config'); | ||
postcssrc().then(({ plugins, options }) => { | ||
console.log(true) | ||
}) | ||
.catch(error=>{ | ||
if (!/No PostCSS Config found/.test(error.message)) { | ||
throw new Error("Failed to load PostCSS config", error) | ||
} | ||
console.log(false) | ||
});`, | ||
]); | ||
const stderr = result.stderr.toString('utf-8').trim(); | ||
if (stderr) console.error(stderr); | ||
if (result.error) throw result.error; | ||
return result.stdout.toString().trim() === 'true'; | ||
} | ||
|
||
console.log(havePostCss()); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
// 'postcss-trolling': {}, | ||
}, | ||
}; |
Oops, something went wrong.