forked from italia/design-web-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.postcss.js
88 lines (77 loc) · 2 KB
/
.postcss.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
'use strict'
const readCache = require("read-cache")
const Config = require('./config')
const util = require('util')
const debuglog = util.debuglog('postcss')
const path = require('path')
const _ = require('lodash')
module.exports = {
use: [
// 'postcss-devtools',
'postcss-easy-import',
'postcss-custom-properties',
'postcss-custom-media',
'postcss-each',
'postcss-nesting',
'postcss-extend',
'postcss-color-function',
'postcss-inline-svg',
'postcss-assets',
'postcss-url',
'postcss-calc',
'autoprefixer',
// @FIXME: get rid of the following
// when dropping support for ie8
'postcss-pseudoelements',
'postcss-flexbugs-fixes',
// 'postcss-reporter'
],
'autoprefixer': {
browsers: ['last 10 versions', 'ie 8', 'ie 9']
},
'postcss-url': {
url: 'copy',
assetsPath: 'assets',
useHash: true,
},
'postcss-inline-svg': {
path: 'src/'
},
'postcss-assets': {
loadPaths: ['src/'],
cachebuster: true
},
'postcss-easy-import': {
// glob: true,
skipDuplicates: true,
/*
* Run `NODE_DEBUG=postcss npm run build:css`
* too watch for excluded modules
*
* @see config.js
*/
load: function(filename, opts) {
const dirname = path.dirname(path.relative(path.resolve('.'), filename))
const exclude = -1 !== _.findIndex(Config.excludes, function(v) {
return dirname.match(new RegExp(v)) !== null
})
const include = !exclude &&
(_.isEmpty(Config.includes) ||
(-1 !== _.findIndex(Config.includes, function(v) {
return dirname.match(new RegExp(v)) !== null
})))
if (include) {
debuglog('including: %s', dirname)
return readCache(filename, "utf-8")
}
debuglog('excluding: %s', dirname)
return Promise.resolve(`/* -- skipped: ${dirname} -- */`)
}
},
postcss: {
from: 'index.css',
to: 'build/build.css',
map: false,
},
stylelint: require('./.stylelintrc')
};