@kaliber/build 0.0.138 → 0.0.139
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/build.js +4 -2
- package/package.json +1 -1
- package/stylelint-plugins/rules/color-schemes/readme.md +6 -6
- package/stylelint-plugins/rules/index/readme.md +1 -1
- package/template/config/default.js +3 -0
- package/template/src/components/home/Intro.css +2 -2
- package/template/src/components/home/pageOnly/Section.css +1 -1
- package/template/src/cssGlobal/colors.css +6 -0
- package/template/src/cssGlobal/media.css +0 -6
- package/template/src/cssGlobal/selectors.css +1 -0
- package/template/src/cssGlobal/type.css +1 -1
- package/template/src/index.css +1 -1
- package/template/src/index.html.js +4 -0
- package/template/src/reset.css +0 -1
- package/webpack-loaders/css-loader.js +10 -11
- package/template/src/cssGlobal/color.css +0 -6
- /package/template/src/cssGlobal/{container.css → sizes.css} +0 -0
package/lib/build.js
CHANGED
@@ -54,6 +54,7 @@ const {
|
|
54
54
|
publicPath = '/',
|
55
55
|
symlinks = true,
|
56
56
|
webpackLoaders: userDefinedWebpackLoaders = [],
|
57
|
+
cssNativeCustomProperties = false,
|
57
58
|
} = {}
|
58
59
|
} = require('@kaliber/config')
|
59
60
|
|
@@ -85,11 +86,12 @@ const babelLoader = {
|
|
85
86
|
|
86
87
|
const cssLoaderGlobalScope = {
|
87
88
|
loader: 'css-loader',
|
88
|
-
options: { globalScopeBehaviour: true }
|
89
|
+
options: { globalScopeBehaviour: true, nativeCustomProperties: cssNativeCustomProperties }
|
89
90
|
}
|
90
91
|
|
91
92
|
const cssLoader = {
|
92
|
-
loader: 'css-loader'
|
93
|
+
loader: 'css-loader',
|
94
|
+
options: { nativeCustomProperties: cssNativeCustomProperties }
|
93
95
|
}
|
94
96
|
|
95
97
|
const cssLoaderMinifyOnly = {
|
package/package.json
CHANGED
@@ -8,15 +8,15 @@ Color schemes are defined by creating files in a `colorScheme` directory or `col
|
|
8
8
|
color: var(--color-white);
|
9
9
|
|
10
10
|
& .color-scheme-icon {
|
11
|
-
color:
|
11
|
+
color: var(--color-red-700);
|
12
12
|
}
|
13
13
|
|
14
14
|
& .color-scheme-exclusion {
|
15
|
-
color: var(--color-red-
|
15
|
+
color: var(--color-red-300);
|
16
16
|
}
|
17
17
|
|
18
18
|
& ::selection {
|
19
|
-
background-color: var(--color-red-
|
19
|
+
background-color: var(--color-red-300);
|
20
20
|
}
|
21
21
|
}
|
22
22
|
```
|
@@ -68,7 +68,7 @@ Examples of *incorrect* code for this rule:
|
|
68
68
|
Before:
|
69
69
|
```css
|
70
70
|
.abc {
|
71
|
-
color: #
|
71
|
+
color: #aabbcc;
|
72
72
|
opacity: 0.5;
|
73
73
|
}
|
74
74
|
```
|
@@ -76,8 +76,8 @@ Before:
|
|
76
76
|
After:
|
77
77
|
```css
|
78
78
|
.abc {
|
79
|
-
color: #
|
79
|
+
color: #aabbcc80;
|
80
80
|
/* or */
|
81
|
-
color:
|
81
|
+
color: rgba(170, 187, 204, 0.5);
|
82
82
|
}
|
83
83
|
```
|
@@ -3,6 +3,9 @@ module.exports = {
|
|
3
3
|
Warning: do not use this to set values that differ in each environment,
|
4
4
|
only use this for configuration that is the same across all config environments
|
5
5
|
*/
|
6
|
+
kaliber: {
|
7
|
+
cssNativeCustomProperties: true
|
8
|
+
},
|
6
9
|
rollbar: {
|
7
10
|
post_client_item: 'get an access token at rollbar.com',
|
8
11
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
.component {
|
2
2
|
padding: 20px;
|
3
3
|
border-radius: 4px;
|
4
|
-
border: 1px solid var(--color-gray-
|
5
|
-
background-color: var(--color-gray-
|
4
|
+
border: 1px solid var(--color-gray-800);
|
5
|
+
background-color: var(--color-gray-100);
|
6
6
|
@media (--viewport-lg) { padding: 40px; }
|
7
7
|
|
8
8
|
& > *:not(:last-child) { margin-bottom: 40px; }
|
@@ -1,9 +1,3 @@
|
|
1
|
-
:export {
|
2
|
-
breakpointSm: 480px;
|
3
|
-
breakpointMd: 768px;
|
4
|
-
breakpointLg: 1024px;
|
5
|
-
}
|
6
|
-
|
7
1
|
@custom-media --viewport-sm screen and (min-width: 480px);
|
8
2
|
@custom-media --viewport-md screen and (min-width: 768px);
|
9
3
|
@custom-media --viewport-lg screen and (min-width: 1024px);
|
@@ -0,0 +1 @@
|
|
1
|
+
@custom-selector :--enter :hover, :focus;
|
package/template/src/index.css
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
import '/reset.css'
|
2
2
|
import '/index.css'
|
3
|
+
import '/cssGlobal/colors.css'
|
4
|
+
import '/cssGlobal/sizes.css'
|
5
|
+
import '/cssGlobal/type.css'
|
6
|
+
|
3
7
|
import stylesheet from '@kaliber/build/lib/stylesheet'
|
4
8
|
import javascript from '@kaliber/build/lib/javascript'
|
5
9
|
import polyfill from '@kaliber/build/lib/polyfill'
|
package/template/src/reset.css
CHANGED
@@ -8,7 +8,7 @@ const vm = require('vm')
|
|
8
8
|
const isProduction = process.env.NODE_ENV === 'production'
|
9
9
|
|
10
10
|
function createPlugins(
|
11
|
-
{ minifyOnly, globalScopeBehaviour, cssGlobalFiles },
|
11
|
+
{ minifyOnly, globalScopeBehaviour, nativeCustomProperties, cssGlobalFiles },
|
12
12
|
{ resolveForImport, resolveForUrlReplace, resolveForImportExportParser }
|
13
13
|
) {
|
14
14
|
|
@@ -22,14 +22,13 @@ function createPlugins(
|
|
22
22
|
require('postcss-modules-values'),
|
23
23
|
require('postcss-preset-env')({
|
24
24
|
features: {
|
25
|
-
'custom-properties': { preserve: false, importFrom: cssGlobalFiles },
|
25
|
+
'custom-properties': !nativeCustomProperties && { preserve: false, importFrom: cssGlobalFiles },
|
26
26
|
'custom-media-queries': { preserve: false, importFrom: cssGlobalFiles },
|
27
27
|
'custom-selectors': { preserve: false, importFrom: cssGlobalFiles },
|
28
28
|
'media-query-ranges': true,
|
29
29
|
'nesting-rules': true,
|
30
30
|
'hexadecimal-alpha-notation': true,
|
31
31
|
'color-functional-notation': true,
|
32
|
-
'color-mod-function': true,
|
33
32
|
'font-variant-property': true,
|
34
33
|
'all-property': true,
|
35
34
|
'any-link-pseudo-class': true,
|
@@ -60,12 +59,12 @@ module.exports = function CssLoader(source, map) {
|
|
60
59
|
const callback = this.async()
|
61
60
|
|
62
61
|
const loaderOptions = loaderUtils.getOptions(this) || {}
|
63
|
-
const { minifyOnly = false, globalScopeBehaviour = false } = loaderOptions
|
62
|
+
const { minifyOnly = false, globalScopeBehaviour = false, nativeCustomProperties = false } = loaderOptions
|
64
63
|
|
65
64
|
const cssGlobalFiles = cachedFindCssGlobalFiles(this)
|
66
65
|
cssGlobalFiles.forEach(x => this.addDependency(x))
|
67
66
|
|
68
|
-
const plugins = getPlugins(this, { minifyOnly, globalScopeBehaviour, cssGlobalFiles })
|
67
|
+
const plugins = getPlugins(this, { minifyOnly, globalScopeBehaviour, nativeCustomProperties, cssGlobalFiles })
|
69
68
|
const filename = relative(this.rootContext, this.resourcePath)
|
70
69
|
const options = {
|
71
70
|
from: this.resourcePath,
|
@@ -109,12 +108,12 @@ module.exports = function CssLoader(source, map) {
|
|
109
108
|
}
|
110
109
|
}
|
111
110
|
|
112
|
-
function getPlugins(loaderContext, { minifyOnly, globalScopeBehaviour, cssGlobalFiles }) {
|
111
|
+
function getPlugins(loaderContext, { minifyOnly, globalScopeBehaviour, nativeCustomProperties, cssGlobalFiles }) {
|
113
112
|
const key = `plugins${minifyOnly ? '-minifyOnly' : ''}${globalScopeBehaviour ? '-globalScope' : ''}`
|
114
113
|
|
115
|
-
return
|
114
|
+
return cachedInCompilation(loaderContext, key, () => {
|
116
115
|
const handlers = createHandlers(loaderContext)
|
117
|
-
const plugins = createPlugins({ minifyOnly, globalScopeBehaviour, cssGlobalFiles }, handlers)
|
116
|
+
const plugins = createPlugins({ minifyOnly, globalScopeBehaviour, nativeCustomProperties, cssGlobalFiles }, handlers)
|
118
117
|
return plugins
|
119
118
|
})
|
120
119
|
}
|
@@ -149,7 +148,7 @@ function createHandlers(loaderContext) {
|
|
149
148
|
|
150
149
|
function executeModuleAt(url, source) {
|
151
150
|
const key = `module-${url}`
|
152
|
-
return
|
151
|
+
return cachedInCompilation(loaderContext, key, () => {
|
153
152
|
|
154
153
|
const sandbox = {
|
155
154
|
module: {},
|
@@ -162,12 +161,12 @@ function createHandlers(loaderContext) {
|
|
162
161
|
}
|
163
162
|
|
164
163
|
function cachedFindCssGlobalFiles(loaderContext) {
|
165
|
-
return
|
164
|
+
return cachedInCompilation(loaderContext, 'global-css-files', () =>
|
166
165
|
findCssGlobalFiles(loaderContext.rootContext)
|
167
166
|
)
|
168
167
|
}
|
169
168
|
|
170
|
-
function
|
169
|
+
function cachedInCompilation(loaderContext, key, f) {
|
171
170
|
const c = loaderContext._compilation
|
172
171
|
const cache = c.kaliberCache || (c.kaliberCache = {})
|
173
172
|
if (cache[key]) return cache[key]
|
File without changes
|