|
6 | 6 | * found in the LICENSE file at https://angular.io/license
|
7 | 7 | */
|
8 | 8 |
|
9 |
| -import createAutoPrefixerPlugin from 'autoprefixer'; |
10 | 9 | import type { OnLoadResult, Plugin, PluginBuild } from 'esbuild';
|
11 | 10 | import glob from 'fast-glob';
|
12 | 11 | import assert from 'node:assert';
|
@@ -62,57 +61,35 @@ export interface StylesheetLanguage {
|
62 | 61 | }
|
63 | 62 |
|
64 | 63 | export class StylesheetPluginFactory {
|
65 |
| - private autoprefixer: import('postcss').Plugin | undefined; |
66 |
| - |
67 | 64 | constructor(
|
68 | 65 | private readonly options: StylesheetPluginOptions,
|
69 | 66 | private readonly cache?: LoadResultCache,
|
70 |
| - ) { |
71 |
| - const autoprefixer = createAutoPrefixerPlugin({ |
72 |
| - overrideBrowserslist: options.browsers, |
73 |
| - ignoreUnknownVersions: true, |
74 |
| - }); |
75 |
| - |
76 |
| - // Autoprefixer currently does not contain a method to check if autoprefixer is required |
77 |
| - // based on the provided list of browsers. However, it does contain a method that returns |
78 |
| - // informational text that can be used as a replacement. The text "Awesome!" will be present |
79 |
| - // when autoprefixer determines no actions are needed. |
80 |
| - // ref: https://github.com/postcss/autoprefixer/blob/e2f5c26ff1f3eaca95a21873723ce1cdf6e59f0e/lib/info.js#L118 |
81 |
| - const autoprefixerInfo = autoprefixer.info(); |
82 |
| - const skipAutoprefixer = autoprefixerInfo.includes('Awesome!'); |
83 |
| - |
84 |
| - if (!skipAutoprefixer) { |
85 |
| - this.autoprefixer = autoprefixer; |
86 |
| - } |
87 |
| - } |
| 67 | + ) {} |
88 | 68 |
|
89 | 69 | create(language: Readonly<StylesheetLanguage>): Plugin {
|
90 | 70 | // Return a noop plugin if no load actions are required
|
91 |
| - if (!language.process && !this.autoprefixer && !this.options.tailwindConfiguration) { |
| 71 | + if (!language.process && !this.options.tailwindConfiguration) { |
92 | 72 | return {
|
93 | 73 | name: 'angular-' + language.name,
|
94 | 74 | setup() {},
|
95 | 75 | };
|
96 | 76 | }
|
97 | 77 |
|
98 |
| - const { autoprefixer, cache, options } = this; |
| 78 | + const { cache, options } = this; |
99 | 79 |
|
100 | 80 | return {
|
101 | 81 | name: 'angular-' + language.name,
|
102 | 82 | async setup(build) {
|
103 |
| - // Setup postcss if needed by either autoprefixer or tailwind |
| 83 | + // Setup postcss if needed by tailwind |
104 | 84 | // TODO: Move this into the plugin factory to avoid repeat setup per created plugin
|
105 | 85 | let postcssProcessor: import('postcss').Processor | undefined;
|
106 |
| - if (autoprefixer || options.tailwindConfiguration) { |
| 86 | + if (options.tailwindConfiguration) { |
107 | 87 | postcss ??= (await import('postcss')).default;
|
108 | 88 | postcssProcessor = postcss();
|
109 | 89 | if (options.tailwindConfiguration) {
|
110 | 90 | const tailwind = await import(options.tailwindConfiguration.package);
|
111 | 91 | postcssProcessor.use(tailwind.default({ config: options.tailwindConfiguration.file }));
|
112 | 92 | }
|
113 |
| - if (autoprefixer) { |
114 |
| - postcssProcessor.use(autoprefixer); |
115 |
| - } |
116 | 93 | }
|
117 | 94 |
|
118 | 95 | // Add a load callback to support inline Component styles
|
|
0 commit comments