Fix conflicts
This commit is contained in:
commit
fd95c5d90f
98 changed files with 4059 additions and 5006 deletions
20
src/cli.js
20
src/cli.js
|
|
@ -8,19 +8,6 @@ import postcss from 'postcss'
|
|||
import process from 'process'
|
||||
import program from 'commander'
|
||||
|
||||
function loadConfig(configPath) {
|
||||
if (configPath === undefined) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
if (!fs.existsSync(path.resolve(configPath))) {
|
||||
console.error(`Config file [${configPath}] does not exist.`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
return require(path.resolve(configPath))
|
||||
}
|
||||
|
||||
function writeStrategy(options) {
|
||||
if (options.output === undefined) {
|
||||
return output => {
|
||||
|
|
@ -46,7 +33,7 @@ function buildTailwind(inputFile, config, write) {
|
|||
.catch(error => console.log(error))
|
||||
}
|
||||
|
||||
const packageJson = require(path.resolve(__dirname, '/../package.json'))
|
||||
const packageJson = require(path.resolve(__dirname, '../package.json'))
|
||||
|
||||
program.version(packageJson.version).usage('<command> [<args>]')
|
||||
|
||||
|
|
@ -65,8 +52,9 @@ program
|
|||
process.exit(1)
|
||||
}
|
||||
|
||||
const output = fs.readFileSync(path.resolve(__dirname, '/../defaultConfig.js'), 'utf8')
|
||||
const output = fs.readFileSync(path.resolve(__dirname, '../defaultConfig.js'), 'utf8')
|
||||
fs.outputFileSync(destination, output.replace('// var defaultConfig', 'var defaultConfig'))
|
||||
console.log(`Generated Tailwind config: ${destination}`)
|
||||
process.exit()
|
||||
})
|
||||
|
||||
|
|
@ -83,7 +71,7 @@ program
|
|||
process.exit(1)
|
||||
}
|
||||
|
||||
buildTailwind(inputFile, loadConfig(options.config), writeStrategy(options)).then(() => {
|
||||
buildTailwind(inputFile, options.config, writeStrategy(options)).then(() => {
|
||||
process.exit()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import defineClasses from '../util/defineClasses'
|
|||
export default function() {
|
||||
return defineClasses({
|
||||
'cursor-auto': { cursor: 'auto' },
|
||||
'cursor-default': { cursor: 'default' },
|
||||
'cursor-pointer': { cursor: 'pointer' },
|
||||
'cursor-not-allowed': { cursor: 'not-allowed' },
|
||||
})
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@ import buildMediaQuery from '../util/buildMediaQuery'
|
|||
export default function(config) {
|
||||
return function(css) {
|
||||
const screens = config().screens
|
||||
const rules = []
|
||||
const responsiveRules = []
|
||||
let finalRules = []
|
||||
|
||||
css.walkAtRules('responsive', atRule => {
|
||||
const nodes = atRule.nodes
|
||||
rules.push(...cloneNodes(nodes))
|
||||
responsiveRules.push(...cloneNodes(nodes))
|
||||
atRule.before(nodes)
|
||||
atRule.remove()
|
||||
})
|
||||
|
|
@ -22,16 +23,34 @@ export default function(config) {
|
|||
})
|
||||
|
||||
mediaQuery.append(
|
||||
rules.map(rule => {
|
||||
responsiveRules.map(rule => {
|
||||
const cloned = rule.clone()
|
||||
cloned.selectors = _.map(rule.selectors, selector => `.${screen}\\:${selector.slice(1)}`)
|
||||
return cloned
|
||||
})
|
||||
)
|
||||
|
||||
if (mediaQuery.nodes.length) {
|
||||
css.append(mediaQuery)
|
||||
finalRules.push(mediaQuery)
|
||||
})
|
||||
|
||||
const hasScreenRules = finalRules.some(i => i.nodes.length !== 0)
|
||||
|
||||
if (!hasScreenRules) {
|
||||
return
|
||||
}
|
||||
|
||||
let includesScreensExplicitly = false
|
||||
|
||||
css.walkAtRules('tailwind', atRule => {
|
||||
if (atRule.params === 'screens') {
|
||||
atRule.replaceWith(finalRules)
|
||||
includesScreensExplicitly = true
|
||||
}
|
||||
})
|
||||
|
||||
if (!includesScreensExplicitly) {
|
||||
css.append(finalRules)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue