faucet-pipeline-css 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.woodpecker/test.yml +15 -0
- package/CHANGELOG.md +20 -1
- package/lib/index.js +14 -24
- package/lib/make-esbuild.js +43 -0
- package/lib/resolver.js +29 -0
- package/lib/transforms.js +15 -0
- package/package.json +8 -11
- package/test/run +7 -2
- package/test/test_assets_integration/expected.css +5 -0
- package/test/test_assets_integration/faucet.config.js +18 -0
- package/test/test_assets_integration/src/index.css +4 -0
- package/test/test_basic/expected.css +7 -2
- package/test/test_basic/faucet.config.js +7 -9
- package/test/test_basic/src/index.css +4 -0
- package/test/test_compact/expected.css +1 -1
- package/test/test_compact/faucet.config.js +7 -9
- package/test/test_error/expected.css +1 -1
- package/test/test_error/faucet.config.js +7 -9
- package/test/test_fingerprinting/expected.css +4 -2
- package/test/test_fingerprinting/expected.json +1 -1
- package/test/test_fingerprinting/faucet.config.js +15 -16
- package/test/test_sourcemap/expected.css +4 -3
- package/test/test_sourcemap/expected.css.map +1 -1
- package/test/test_sourcemap/faucet.config.js +7 -9
- package/test/test_transform/expected.css +12 -0
- package/test/test_transform/faucet.config.js +9 -0
- package/test/test_transform/src/index.css +9 -0
- package/test/test_transform/src/lib.css +3 -0
- package/.github/dependabot.yml +0 -13
- package/.github/workflows/tests.yaml +0 -20
- package/lib/asset-url.js +0 -14
- package/lib/make-postcss.js +0 -55
- package/test/test_static_integration/expected.css +0 -4
- package/test/test_static_integration/faucet.config.js +0 -18
- package/test/test_static_integration/src/index.css +0 -4
- /package/test/{test_static_integration → test_assets_integration}/expected.json +0 -0
- /package/test/{test_static_integration → test_assets_integration}/src/spacer.gif +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
faucet-pipeline-css version history
|
|
2
2
|
===================================
|
|
3
3
|
|
|
4
|
+
v0.5.0
|
|
5
|
+
------
|
|
6
|
+
|
|
7
|
+
_2026-04-07_
|
|
8
|
+
|
|
9
|
+
notable changes for end users:
|
|
10
|
+
|
|
11
|
+
* **Breaking Change:** added fingerprint integration to `url`
|
|
12
|
+
and removed `asset-url`.
|
|
13
|
+
* added support for transforming CSS nesting enabled by adding
|
|
14
|
+
`transform: ["nesting"]` to the configuration.
|
|
15
|
+
* dropped support for Node 21 and below
|
|
16
|
+
* update dependencies
|
|
17
|
+
|
|
18
|
+
notable changes for developers:
|
|
19
|
+
* moved from GitHub to Codeberg
|
|
20
|
+
* switched from CJS to ESM
|
|
21
|
+
|
|
22
|
+
|
|
4
23
|
v0.4.0
|
|
5
24
|
------
|
|
6
25
|
|
|
@@ -39,7 +58,7 @@ notable changes for end users:
|
|
|
39
58
|
|
|
40
59
|
* updated dependencies
|
|
41
60
|
|
|
42
|
-
notable changes for
|
|
61
|
+
notable changes for developers:
|
|
43
62
|
|
|
44
63
|
* updated to new PostCSS API
|
|
45
64
|
* switched to Github Actions and Dependabot
|
package/lib/index.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { abort } from "faucet-pipeline-core/lib/util/index.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { makeESBuild } from "./make-esbuild.js";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
bucket: "styles",
|
|
8
|
-
plugin: faucetCSS
|
|
9
|
-
};
|
|
5
|
+
export let key = "css";
|
|
6
|
+
export let bucket = "styles";
|
|
10
7
|
|
|
11
|
-
function
|
|
8
|
+
export function plugin(config, assetManager, { compact, sourcemaps } = {}) {
|
|
12
9
|
let bundlers = config.map(bundleConfig => makeBundler(bundleConfig,
|
|
13
|
-
assetManager, {
|
|
10
|
+
assetManager, { compact, sourcemaps }));
|
|
14
11
|
|
|
15
12
|
return filepaths => Promise.all(bundlers.
|
|
16
13
|
map(bundler => bundler(filepaths)));
|
|
17
14
|
}
|
|
18
15
|
|
|
19
|
-
function makeBundler(config, assetManager, {
|
|
20
|
-
let {
|
|
16
|
+
function makeBundler(config, assetManager, { compact, sourcemaps } = {}) {
|
|
17
|
+
let { fingerprint } = config;
|
|
21
18
|
|
|
22
19
|
if(!config.source || !config.target) {
|
|
23
20
|
abort("ERROR: CSS configuration requires both target and source");
|
|
@@ -25,22 +22,15 @@ function makeBundler(config, assetManager, { browsers, compact, sourcemaps } = {
|
|
|
25
22
|
|
|
26
23
|
let source = assetManager.resolvePath(config.source);
|
|
27
24
|
let target = assetManager.resolvePath(config.target, { enforceRelative: true });
|
|
25
|
+
let { transform } = config;
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
browsers = null;
|
|
31
|
-
} else if(browserslist) {
|
|
32
|
-
browsers = browsers[browserslist];
|
|
33
|
-
} else {
|
|
34
|
-
browsers = browsers.defaults;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
let postCSS = makePostCSS(
|
|
27
|
+
let esbuild = makeESBuild(
|
|
38
28
|
source,
|
|
39
29
|
target,
|
|
40
30
|
assetManager,
|
|
41
31
|
sourcemaps,
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
compact,
|
|
33
|
+
transform
|
|
44
34
|
);
|
|
45
35
|
|
|
46
36
|
let previouslyIncludedFiles;
|
|
@@ -49,7 +39,7 @@ function makeBundler(config, assetManager, { browsers, compact, sourcemaps } = {
|
|
|
49
39
|
// If this is the first run or the changed file is one of the
|
|
50
40
|
// previously included ones, run the compiler
|
|
51
41
|
if(previouslyIncluded(filepaths, previouslyIncludedFiles)) {
|
|
52
|
-
return
|
|
42
|
+
return esbuild().
|
|
53
43
|
then(result => {
|
|
54
44
|
previouslyIncludedFiles = result.stats.includedFiles.
|
|
55
45
|
map(filepath => path.normalize(filepath));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { build } from "esbuild";
|
|
2
|
+
import { Resolver } from "./resolver.js";
|
|
3
|
+
import { supportedFeaturesFor } from "./transforms.js";
|
|
4
|
+
|
|
5
|
+
export function makeESBuild(input, target, assetManager, sourcemaps, compact, transform) {
|
|
6
|
+
let resolver = new Resolver(assetManager.manifest);
|
|
7
|
+
|
|
8
|
+
return async function() {
|
|
9
|
+
let { outputFiles, errors, warnings } = await build({
|
|
10
|
+
entryPoints: [input],
|
|
11
|
+
bundle: true,
|
|
12
|
+
write: false,
|
|
13
|
+
minifyWhitespace: compact,
|
|
14
|
+
sourcemap: sourcemaps ? "inline" : false,
|
|
15
|
+
supported: supportedFeaturesFor(transform),
|
|
16
|
+
plugins: [{
|
|
17
|
+
name: "faucet-resolver",
|
|
18
|
+
setup(build) {
|
|
19
|
+
build.onResolve({ filter: /.*/ }, resolver.resolve);
|
|
20
|
+
}
|
|
21
|
+
}],
|
|
22
|
+
outfile: target
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// we treat warnings as errors, too
|
|
26
|
+
if(errors.length > 0 || warnings.length > 0) {
|
|
27
|
+
throw buildError([...errors, ...warnings]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
css: outputFiles[0].contents,
|
|
32
|
+
stats: {
|
|
33
|
+
includedFiles: resolver.includedFiles
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// builds an error for the first error
|
|
40
|
+
function buildError(messages) {
|
|
41
|
+
let { location, text } = messages[0];
|
|
42
|
+
return new Error(`${location.file}:${location.line}:${location.column}: ${text}`);
|
|
43
|
+
}
|
package/lib/resolver.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { join, isAbsolute } from "path";
|
|
2
|
+
|
|
3
|
+
export class Resolver {
|
|
4
|
+
constructor(manifest) {
|
|
5
|
+
this.manifest = manifest;
|
|
6
|
+
this._includedFiles = new Set();
|
|
7
|
+
this.resolve = this.resolve.bind(this);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
resolve({ path, resolveDir, kind }) {
|
|
11
|
+
if(kind === "url-token") {
|
|
12
|
+
return {
|
|
13
|
+
external: true,
|
|
14
|
+
path: this.manifest.get(path)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if(!isAbsolute(path)) {
|
|
19
|
+
path = join(resolveDir, path);
|
|
20
|
+
}
|
|
21
|
+
this._includedFiles.add(path);
|
|
22
|
+
|
|
23
|
+
return { path };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get includedFiles() {
|
|
27
|
+
return Array.from(this._includedFiles);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
let SUPPORTED_TRANSFORMS = ["nesting"];
|
|
2
|
+
|
|
3
|
+
// all transforms need to be converted into not supported features
|
|
4
|
+
export function supportedFeaturesFor(transforms = []) {
|
|
5
|
+
let supported = {};
|
|
6
|
+
|
|
7
|
+
for(let transform of transforms) {
|
|
8
|
+
if(!SUPPORTED_TRANSFORMS.includes(transform)) {
|
|
9
|
+
throw new Error(`Unknown transform: '${transform}`);
|
|
10
|
+
}
|
|
11
|
+
supported[transform] = false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return supported;
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "faucet-pipeline-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "CSS for faucet-pipeline",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"test": "npm-run-all --parallel lint test:cli",
|
|
8
9
|
"test:cli": "./test/run",
|
|
@@ -10,28 +11,24 @@
|
|
|
10
11
|
},
|
|
11
12
|
"repository": {
|
|
12
13
|
"type": "git",
|
|
13
|
-
"url": "git+https://
|
|
14
|
+
"url": "git+https://codeberg.org/faucet-pipeline/faucet-pipeline-css.git"
|
|
14
15
|
},
|
|
15
16
|
"author": "Lucas Dohmen <lucas@dohmen.io> (https://lucas.dohmen.io/)",
|
|
16
17
|
"license": "Apache-2.0",
|
|
17
18
|
"bugs": {
|
|
18
|
-
"url": "https://
|
|
19
|
+
"url": "https://codeberg.org/faucet-pipeline/faucet-pipeline-css/issues"
|
|
19
20
|
},
|
|
20
21
|
"homepage": "https://www.faucet-pipeline.org",
|
|
21
22
|
"engines": {
|
|
22
|
-
"node": ">=
|
|
23
|
+
"node": ">= 22"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"postcss-discard-comments": "~7.0.4",
|
|
28
|
-
"postcss-import": "~16.1.1",
|
|
29
|
-
"postcss-message-helpers": "~2.0.0",
|
|
30
|
-
"postcss-normalize-whitespace": "~7.0.1"
|
|
26
|
+
"esbuild": "^0.28.0",
|
|
27
|
+
"faucet-pipeline-core": "^2.1.0"
|
|
31
28
|
},
|
|
32
29
|
"devDependencies": {
|
|
33
30
|
"eslint-config-fnd": "^1.13.0",
|
|
34
|
-
"faucet-pipeline-
|
|
31
|
+
"faucet-pipeline-assets": "^0.2.0",
|
|
35
32
|
"json-diff": "^1.0.0",
|
|
36
33
|
"npm-run-all": "^4.1.5",
|
|
37
34
|
"release-util-fnd": "^3.0.0"
|
package/test/run
CHANGED
|
@@ -17,6 +17,11 @@ begin "$root/test_compact"
|
|
|
17
17
|
assert_identical "./dist/bundle.css" "./expected.css"
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
begin "$root/test_transform"
|
|
21
|
+
faucet
|
|
22
|
+
assert_identical "./dist/bundle.css" "./expected.css"
|
|
23
|
+
end
|
|
24
|
+
|
|
20
25
|
begin "$root/test_error"
|
|
21
26
|
faucet || echo "Crashed successfully"
|
|
22
27
|
assert_identical "./dist/bundle.css" "./expected.css"
|
|
@@ -24,7 +29,7 @@ end
|
|
|
24
29
|
|
|
25
30
|
begin "$root/test_fingerprinting"
|
|
26
31
|
faucet --fingerprint
|
|
27
|
-
assert_identical "./dist/fingerprint/bundle-
|
|
32
|
+
assert_identical "./dist/fingerprint/bundle-c66c84866d9b31a4d434a2d15915d9f9.css" "./expected.css"
|
|
28
33
|
assert_identical "./dist/no-fingerprint/bundle.css" "./expected.css"
|
|
29
34
|
assert_json "./dist/manifest.json" "./expected.json"
|
|
30
35
|
end
|
|
@@ -34,7 +39,7 @@ begin "$root/test_sourcemap"
|
|
|
34
39
|
assert_identical_sourcemap "./dist/bundle.css" "./expected.css" "./expected.css.map"
|
|
35
40
|
end
|
|
36
41
|
|
|
37
|
-
begin "$root/
|
|
42
|
+
begin "$root/test_assets_integration"
|
|
38
43
|
faucet
|
|
39
44
|
assert_identical "./dist/bundle.css" "./expected.css"
|
|
40
45
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
|
|
3
|
+
export const css = [{
|
|
4
|
+
source: "./src/index.css",
|
|
5
|
+
target: "./dist/bundle.css"
|
|
6
|
+
}];
|
|
7
|
+
|
|
8
|
+
export const assets = [{
|
|
9
|
+
source: "./src/spacer.gif",
|
|
10
|
+
target: "./dist/spacer.gif"
|
|
11
|
+
}];
|
|
12
|
+
|
|
13
|
+
export const manifest = {
|
|
14
|
+
target: "./dist/manifest.json",
|
|
15
|
+
value: f => `/assets/${f}`
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const plugins = [resolve(import.meta.dirname, "../..")];
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
let path = require("path");
|
|
1
|
+
import { resolve } from "node:path";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
3
|
+
export const css = [{
|
|
4
|
+
source: "./src/index.css",
|
|
5
|
+
target: "./dist/bundle.css"
|
|
6
|
+
}];
|
|
7
|
+
|
|
8
|
+
export const plugins = [resolve(import.meta.dirname, "../..")];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.bar{color:red}.foo{color:green}
|
|
1
|
+
.bar{color:red}.foo{color:green}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
let path = require("path");
|
|
1
|
+
import { resolve } from "node:path";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
3
|
+
export const css = [{
|
|
4
|
+
source: "./src/index.css",
|
|
5
|
+
target: "./dist/bundle.css"
|
|
6
|
+
}];
|
|
7
|
+
|
|
8
|
+
export const plugins = [resolve(import.meta.dirname, "../..")];
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
let path = require("path");
|
|
1
|
+
import { resolve } from "node:path";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
3
|
+
export const css = [{
|
|
4
|
+
source: "./src/index.css",
|
|
5
|
+
target: "./dist/bundle.css"
|
|
6
|
+
}];
|
|
7
|
+
|
|
8
|
+
export const plugins = [resolve(import.meta.dirname, "../..")];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"dist/fingerprint/bundle.css":"/assets/dist/fingerprint/bundle-
|
|
1
|
+
{"dist/fingerprint/bundle.css":"/assets/dist/fingerprint/bundle-c66c84866d9b31a4d434a2d15915d9f9.css","dist/no-fingerprint/bundle.css":"/assets/dist/no-fingerprint/bundle.css"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
let path = require("path");
|
|
1
|
+
import { resolve } from "node:path";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
plugins: [path.resolve("../..")]
|
|
3
|
+
export const css = [{
|
|
4
|
+
source: "./src/index.css",
|
|
5
|
+
target: "./dist/fingerprint/bundle.css"
|
|
6
|
+
}, {
|
|
7
|
+
source: "./src/index.css",
|
|
8
|
+
target: "./dist/no-fingerprint/bundle.css",
|
|
9
|
+
fingerprint: false
|
|
10
|
+
}];
|
|
11
|
+
|
|
12
|
+
export const manifest = {
|
|
13
|
+
target: "./dist/manifest.json",
|
|
14
|
+
value: f => `/assets/${f}`
|
|
18
15
|
};
|
|
16
|
+
|
|
17
|
+
export const plugins = [resolve(import.meta.dirname, "../..")];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version":3,
|
|
3
3
|
"names":[],
|
|
4
|
-
"mappings":"AAAA;
|
|
4
|
+
"mappings":";AAAA,CAAC;AACA,SAAO;AACR;;;ACAA,CAAC;AACA,SAAO;AACR;",
|
|
5
5
|
"sourcesContent":[
|
|
6
6
|
".bar {\n\tcolor: red;\n}\n",
|
|
7
7
|
"@import \"./lib.css\";\n\n.foo {\n\tcolor: green;\n}\n"
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
let path = require("path");
|
|
1
|
+
import { resolve } from "node:path";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
3
|
+
export const css = [{
|
|
4
|
+
source: "./src/index.css",
|
|
5
|
+
target: "./dist/bundle.css"
|
|
6
|
+
}];
|
|
7
|
+
|
|
8
|
+
export const plugins = [resolve(import.meta.dirname, "../..")];
|
package/.github/dependabot.yml
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
updates:
|
|
3
|
-
# Maintain dependencies for GitHub Actions
|
|
4
|
-
- package-ecosystem: "github-actions"
|
|
5
|
-
directory: "/"
|
|
6
|
-
schedule:
|
|
7
|
-
interval: "daily"
|
|
8
|
-
|
|
9
|
-
# Maintain dependencies for npm
|
|
10
|
-
- package-ecosystem: "npm"
|
|
11
|
-
directory: "/"
|
|
12
|
-
schedule:
|
|
13
|
-
interval: "daily"
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
on:
|
|
2
|
-
- push
|
|
3
|
-
|
|
4
|
-
jobs:
|
|
5
|
-
test:
|
|
6
|
-
runs-on: ubuntu-latest
|
|
7
|
-
strategy:
|
|
8
|
-
matrix:
|
|
9
|
-
node-version:
|
|
10
|
-
- 20.x
|
|
11
|
-
- 24.x
|
|
12
|
-
- latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v5
|
|
15
|
-
- uses: actions/setup-node@v6
|
|
16
|
-
with:
|
|
17
|
-
node-version: ${{ matrix.node-version }}
|
|
18
|
-
- run: npm install-test
|
|
19
|
-
env:
|
|
20
|
-
CI: true
|
package/lib/asset-url.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
let ASSET_URL_PATTERN = /asset-url\(['"]?(.*?)['"]?\)/;
|
|
2
|
-
|
|
3
|
-
module.exports = ({ manifest }) => {
|
|
4
|
-
return {
|
|
5
|
-
postcssPlugin: "postcss-asset-url",
|
|
6
|
-
Declaration(decl) {
|
|
7
|
-
if(ASSET_URL_PATTERN.test(decl.value)) {
|
|
8
|
-
decl.value = decl.value.replace(ASSET_URL_PATTERN,
|
|
9
|
-
(match, url) => `url("${manifest.get(url)}")`);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
module.exports.postcss = true;
|
package/lib/make-postcss.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
let postcss = require("postcss");
|
|
2
|
-
let atImport = require("postcss-import");
|
|
3
|
-
let assetURL = require("./asset-url");
|
|
4
|
-
let { readFile } = require("node:fs/promises");
|
|
5
|
-
|
|
6
|
-
module.exports = function(input, target, assetManager, sourcemaps, browsers, compact) {
|
|
7
|
-
let plugins = [
|
|
8
|
-
atImport(),
|
|
9
|
-
assetURL({ manifest: assetManager.manifest })
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
if(compact) {
|
|
13
|
-
plugins.push(
|
|
14
|
-
require("postcss-discard-comments")(),
|
|
15
|
-
require("postcss-normalize-whitespace")()
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let processor = postcss(plugins);
|
|
20
|
-
|
|
21
|
-
let options = {
|
|
22
|
-
from: input,
|
|
23
|
-
target
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
if(sourcemaps) {
|
|
27
|
-
options.map = { inline: true };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return () => {
|
|
31
|
-
return readFile(input).then(code => {
|
|
32
|
-
return processor.process(code, options);
|
|
33
|
-
}).then(result => {
|
|
34
|
-
let warnings = result.warnings();
|
|
35
|
-
|
|
36
|
-
if(warnings.length > 0) {
|
|
37
|
-
let errorMessage = warnings.
|
|
38
|
-
map(warning => warning.toString()).
|
|
39
|
-
join("\n");
|
|
40
|
-
throw new Error(errorMessage);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
let includedFiles = result.messages.
|
|
44
|
-
filter(message => message.type === "dependency").
|
|
45
|
-
map(message => message.file);
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
css: result.css,
|
|
49
|
-
stats: {
|
|
50
|
-
includedFiles: [input].concat(includedFiles)
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
let path = require("path");
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
css: [{
|
|
6
|
-
source: "./src/index.css",
|
|
7
|
-
target: "./dist/bundle.css"
|
|
8
|
-
}],
|
|
9
|
-
static: [{
|
|
10
|
-
source: "./src/spacer.gif",
|
|
11
|
-
target: "./dist/spacer.gif"
|
|
12
|
-
}],
|
|
13
|
-
manifest: {
|
|
14
|
-
target: "./dist/manifest.json",
|
|
15
|
-
value: f => `/assets/${f}`
|
|
16
|
-
},
|
|
17
|
-
plugins: [path.resolve("../..")]
|
|
18
|
-
};
|
|
File without changes
|
|
File without changes
|