Switch to separate config import

Import default config from separate path (require('tailwindcss/defaultConfig')) to allow importing the default config without importing all of Tailwind, which causes errors with Webpack due to a dynamic require.
This commit is contained in:
Jonathan Reinink 2017-11-14 08:03:31 -05:00
parent 5e6bfb2f9e
commit 1faabc82b1
9 changed files with 781 additions and 782 deletions

View file

@ -29,5 +29,5 @@ Please see the [installation](/docs/installation#4-process-your-css-with-tailwin
As you can see below, the default config file is heavily documented. Read through it to get a better understanding of how each section can be customized for your project.
```js
{!! file_get_contents(dirname(dirname(__DIR__)).'/defaultConfig.js') !!}
{!! str_replace('// var defaultConfig', 'var defaultConfig', file_get_contents(dirname(dirname(__DIR__)).'/defaultConfig.stub.js')) !!}
```

View file

@ -1,4 +1,4 @@
var config = require('../lib/index').defaultConfig()
var config = require('../defaultConfig')()
config.colors = Object.assign(config.colors, {
'slate-darker': '#212b35',

View file

@ -7,7 +7,7 @@ const tailwind = require('./../lib/index.js')
const config = require('./../defaultConfig.js')
const fs = require('fs')
fs.writeFileSync('./tailwind.json', JSON.stringify(config))
fs.writeFileSync('./tailwind.json', JSON.stringify(config()))
const env = argv.e || argv.env || 'local'
const plugins = [