2018-10-26 01:49:22 +02:00
|
|
|
class TailwindExtractor {
|
|
|
|
static extract(content) {
|
|
|
|
return content.match(/[A-Za-z0-9-_:/]+/g) || [];
|
2018-02-13 20:32:59 +01:00
|
|
|
}
|
2018-10-26 01:49:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const options = {
|
|
|
|
plugins: [
|
|
|
|
require('tailwindcss')('./tailwind.js'),
|
2018-10-26 03:55:11 +02:00
|
|
|
require('postcss-preset-env')
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
|
|
options.map = { inline: true };
|
|
|
|
} else {
|
|
|
|
options.plugins.push(
|
2018-10-26 01:49:22 +02:00
|
|
|
require('@fullhuman/postcss-purgecss')({
|
2018-11-15 06:13:38 +01:00
|
|
|
content: [
|
|
|
|
'./app/*.js',
|
|
|
|
'./app/ui/*.js',
|
|
|
|
'./android/*.js',
|
|
|
|
'./android/pages/*.js'
|
|
|
|
],
|
2018-10-26 01:49:22 +02:00
|
|
|
extractors: [
|
|
|
|
{
|
|
|
|
extractor: TailwindExtractor,
|
|
|
|
extensions: ['js']
|
|
|
|
}
|
|
|
|
]
|
2018-10-26 03:55:11 +02:00
|
|
|
})
|
|
|
|
);
|
|
|
|
options.plugins.push(
|
2018-10-26 01:49:22 +02:00
|
|
|
require('cssnano')({
|
|
|
|
preset: 'default'
|
|
|
|
})
|
2018-10-26 03:55:11 +02:00
|
|
|
);
|
2017-08-04 02:07:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = options;
|