@financial-times/dotcom-build-sass 9.5.1 → 10.0.0-beta.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/README.md CHANGED
@@ -69,8 +69,11 @@ The CSS loader has `@import` and `url()` resolution disabled as these should be
69
69
  | Option | Type | Default | Description |
70
70
  |-------------------|----------|---------|--------------------------------------------------------------------|
71
71
  | `webpackImporter` | Boolean | `false` | See https://github.com/webpack-contrib/sass-loader#webpackimporter |
72
- | `prependData` | String | `''` | See https://webpack.js.org/loaders/sass-loader/#prependdata |
72
+ | `additionalData` | String | `''` | https://webpack.js.org/loaders/sass-loader/#additionaldata |
73
73
  | `includePaths` | String[] | `[]` | See https://sass-lang.com/documentation/js-api#includepaths |
74
+ | `implementation` | `sass\|sass-embedded` | `sass` | See https://webpack.js.org/loaders/sass-loader/#implementation |
75
+
76
+ `additionalData` replaces `prependData` as of sass-loader v9. `prependData` is still supported in this package, but is deprecated.
74
77
 
75
78
  ## Sass build monitoring
76
79
 
@@ -2,12 +2,16 @@ import type webpack from 'webpack';
2
2
  export declare type TPluginOptions = {
3
3
  includePaths?: string[];
4
4
  prependData?: string;
5
+ additionalData?: string;
5
6
  webpackImporter?: boolean;
7
+ implementation?: 'sass' | 'sass-embedded';
6
8
  };
7
9
  export declare class PageKitSassPlugin {
8
10
  includePaths: string[];
9
11
  prependData: string;
12
+ additionalData: string;
10
13
  webpackImporter: boolean;
11
- constructor({ includePaths, prependData, webpackImporter }?: TPluginOptions);
14
+ implementation: 'sass' | 'sass-embedded';
15
+ constructor({ includePaths, prependData, additionalData, webpackImporter, implementation }?: TPluginOptions);
12
16
  apply(compiler: webpack.Compiler): void;
13
17
  }
@@ -7,10 +7,11 @@ exports.PageKitSassPlugin = void 0;
7
7
  const webpack_fix_style_only_entries_1 = __importDefault(require("webpack-fix-style-only-entries"));
8
8
  const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
9
9
  class PageKitSassPlugin {
10
- constructor({ includePaths = [], prependData = '', webpackImporter } = {}) {
10
+ constructor({ includePaths = [], prependData = '', additionalData = '', webpackImporter, implementation = 'sass' } = {}) {
11
11
  this.includePaths = includePaths;
12
- this.prependData = prependData;
12
+ this.additionalData = additionalData.length ? additionalData : prependData;
13
13
  this.webpackImporter = webpackImporter;
14
+ this.implementation = implementation;
14
15
  }
15
16
  apply(compiler) {
16
17
  const sassLoaderOptions = {
@@ -18,11 +19,11 @@ class PageKitSassPlugin {
18
19
  // but we don't usually use this and disabling it can speed up builds by up to 20%.
19
20
  webpackImporter: this.webpackImporter,
20
21
  // Prefer `dart-sass`.
21
- implementation: require('sass'),
22
+ implementation: require(this.implementation),
22
23
  // Prepends SCSS code before the actual entry file.
23
24
  // Introduced to maintain snappy grid after n-ui-foundations removed it as the default.
24
25
  // Once user-facing apps and components move away from using snappy grid then this can be removed.
25
- prependData: this.prependData,
26
+ additionalData: this.additionalData,
26
27
  sassOptions: {
27
28
  // Disable formatting so that we don't spend time pretty printing
28
29
  outputStyle: 'compressed',
@@ -452,8 +452,8 @@
452
452
  "affectsGlobalScope": false
453
453
  },
454
454
  "../src/index.ts": {
455
- "version": "7fb00d27970b40b6bb55e0082ba7f14114cc4e5d23fc9912cea1da42e24ba5bc",
456
- "signature": "38296bee587ffb2a33b5f3e8c31f22f263d27c65a68666824e3b2f717e212a84",
455
+ "version": "1ce57a946d739703fe823574857b093f8ce75836a0b4f6f0a7cdd7869ae61972",
456
+ "signature": "74262782cc0e8e7f07d44046b78a6f97239ae1d2282c2763ac54e90f909bbbd5",
457
457
  "affectsGlobalScope": false
458
458
  },
459
459
  "../src/monitored-sass-loader.ts": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/dotcom-build-sass",
3
- "version": "9.5.1",
3
+ "version": "10.0.0-beta.0",
4
4
  "description": "",
5
5
  "main": "dist/node/index.js",
6
6
  "types": "dist/node/index.d.ts",
@@ -27,8 +27,9 @@
27
27
  "cssnano": "^4.1.10",
28
28
  "mini-css-extract-plugin": "^0.12.0",
29
29
  "postcss-loader": "^4.0.0",
30
- "sass": "^1.25.0",
31
- "sass-loader": "^8.0.0",
30
+ "sass": "^1.77.2",
31
+ "sass-embedded": "^1.77.2",
32
+ "sass-loader": "^10.5.2",
32
33
  "webpack-fix-style-only-entries": "^0.5.0"
33
34
  },
34
35
  "devDependencies": {
package/src/index.ts CHANGED
@@ -4,19 +4,30 @@ import type webpack from 'webpack'
4
4
 
5
5
  export type TPluginOptions = {
6
6
  includePaths?: string[]
7
- prependData?: string
7
+ prependData?: string // DEPRECATED IN FAVOUR OF additionalData
8
+ additionalData?: string
8
9
  webpackImporter?: boolean
10
+ implementation?: 'sass' | 'sass-embedded'
9
11
  }
10
12
 
11
13
  export class PageKitSassPlugin {
12
14
  includePaths: string[]
13
- prependData: string
15
+ prependData: string // DEPRECATED IN FAVOUR OF additionalData
16
+ additionalData: string
14
17
  webpackImporter: boolean
18
+ implementation: 'sass' | 'sass-embedded'
15
19
 
16
- constructor({ includePaths = [], prependData = '', webpackImporter }: TPluginOptions = {}) {
20
+ constructor({
21
+ includePaths = [],
22
+ prependData = '',
23
+ additionalData = '',
24
+ webpackImporter,
25
+ implementation = 'sass'
26
+ }: TPluginOptions = {}) {
17
27
  this.includePaths = includePaths
18
- this.prependData = prependData
28
+ this.additionalData = additionalData.length ? additionalData : prependData
19
29
  this.webpackImporter = webpackImporter
30
+ this.implementation = implementation
20
31
  }
21
32
 
22
33
  apply(compiler: webpack.Compiler) {
@@ -25,11 +36,11 @@ export class PageKitSassPlugin {
25
36
  // but we don't usually use this and disabling it can speed up builds by up to 20%.
26
37
  webpackImporter: this.webpackImporter,
27
38
  // Prefer `dart-sass`.
28
- implementation: require('sass'),
39
+ implementation: require(this.implementation),
29
40
  // Prepends SCSS code before the actual entry file.
30
41
  // Introduced to maintain snappy grid after n-ui-foundations removed it as the default.
31
42
  // Once user-facing apps and components move away from using snappy grid then this can be removed.
32
- prependData: this.prependData,
43
+ additionalData: this.additionalData,
33
44
  sassOptions: {
34
45
  // Disable formatting so that we don't spend time pretty printing
35
46
  outputStyle: 'compressed',