Extract reset to separate file, inline SUIT CSS Base, rename @tailwind at-rules

This commit is contained in:
Adam Wathan 2017-10-11 09:35:04 -04:00
parent 57cb4159a4
commit cd41069cba
17 changed files with 170 additions and 114 deletions

View file

@ -5,10 +5,10 @@ import defaultConfig from './defaultConfig'
console.info('Building Tailwind!')
fs.readFile('./src/tailwind.css', (err, css) => {
fs.readFile('./css/tailwind.css', (err, css) => {
postcss([tailwind(defaultConfig)])
.process(css, {
from: './tailwind.css',
from: './css/tailwind.css',
to: './dist/tailwind.css',
map: {inline: false},
})

View file

@ -38,8 +38,8 @@ import zIndex from '../generators/zIndex'
export default function(options) {
return function(css) {
css.walkAtRules('tailwind-utilities', atRule => {
if (atRule.params === 'all') {
css.walkAtRules('tailwind', atRule => {
if (atRule.params === 'utilities') {
const utilities = _.flatten([
appearance(options),
textSizes(options),

View file

@ -1,3 +1,4 @@
import fs from 'fs'
import postcss from 'postcss'
import postcssImport from 'postcss-import'
@ -6,27 +7,15 @@ export default function(options) {
return new Promise((resolve, reject) => {
const promises = []
css.walkAtRules('tailwind-reset', atRule => {
promises.push(postcssImport.process(postcss.parse(`
@import "normalize.css";
@import "suitcss-base";
textarea { resize: vertical; }
img { max-width: 100%; }
svg { fill: currentColor; }
input { font-family: inherit; }
input::placeholder {
color: inherit;
opacity: .7;
}
button, [role=button] {
font-family: inherit;
cursor: pointer;
}
`)).then(result => {
atRule.before(result.root)
atRule.remove()
}))
css.walkAtRules('tailwind', atRule => {
if (atRule.params === 'reset') {
promises.push(postcssImport.process(postcss.parse(fs.readFileSync(`${__dirname}/../../css/preflight.css`, {
encoding: 'utf8'
}))).then(result => {
atRule.before(result.root)
atRule.remove()
}))
}
})
Promise.all(promises).then(resolve)

View file

@ -1,3 +0,0 @@
@tailwind-reset;
@tailwind-utilities all;