Skip to content

Commit

Permalink
Merge pull request #149 from tailwindcss/fix-path-issues
Browse files Browse the repository at this point in the history
Fix path issues in CLI
  • Loading branch information
adamwathan authored Nov 8, 2017
2 parents 6edbda3 + 8ebc567 commit 1d1e96d
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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>]')

Expand All @@ -65,7 +52,7 @@ 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'))
process.exit()
})
Expand All @@ -83,7 +70,7 @@ program
process.exit(1)
}

buildTailwind(inputFile, loadConfig(options.config), writeStrategy(options)).then(() => {
buildTailwind(inputFile, options.config, writeStrategy(options)).then(() => {
process.exit()
})
})
Expand Down

0 comments on commit 1d1e96d

Please sign in to comment.