Skip to content

Commit 1d1e96d

Browse files
authored
Merge pull request #149 from tailwindcss/fix-path-issues
Fix path issues in CLI
2 parents 6edbda3 + 8ebc567 commit 1d1e96d

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/cli.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,6 @@ import postcss from 'postcss'
88
import process from 'process'
99
import program from 'commander'
1010

11-
function loadConfig(configPath) {
12-
if (configPath === undefined) {
13-
return undefined
14-
}
15-
16-
if (!fs.existsSync(path.resolve(configPath))) {
17-
console.error(`Config file [${configPath}] does not exist.`)
18-
process.exit(1)
19-
}
20-
21-
return require(path.resolve(configPath))
22-
}
23-
2411
function writeStrategy(options) {
2512
if (options.output === undefined) {
2613
return output => {
@@ -46,7 +33,7 @@ function buildTailwind(inputFile, config, write) {
4633
.catch(error => console.log(error))
4734
}
4835

49-
const packageJson = require(path.resolve(__dirname, '/../package.json'))
36+
const packageJson = require(path.resolve(__dirname, '../package.json'))
5037

5138
program.version(packageJson.version).usage('<command> [<args>]')
5239

@@ -65,7 +52,7 @@ program
6552
process.exit(1)
6653
}
6754

68-
const output = fs.readFileSync(path.resolve(__dirname, '/../defaultConfig.js'), 'utf8')
55+
const output = fs.readFileSync(path.resolve(__dirname, '../defaultConfig.js'), 'utf8')
6956
fs.outputFileSync(destination, output.replace('// var defaultConfig', 'var defaultConfig'))
7057
process.exit()
7158
})
@@ -83,7 +70,7 @@ program
8370
process.exit(1)
8471
}
8572

86-
buildTailwind(inputFile, loadConfig(options.config), writeStrategy(options)).then(() => {
73+
buildTailwind(inputFile, options.config, writeStrategy(options)).then(() => {
8774
process.exit()
8875
})
8976
})

0 commit comments

Comments
 (0)