@epublishing/grunt-epublishing 0.3.24 → 0.3.26

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.
Files changed (2) hide show
  1. package/package.json +3 -2
  2. package/tasks/sass.js +22 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epublishing/grunt-epublishing",
3
3
  "description": "Automated front-end tasks for ePublishing Jade and client sites.",
4
- "version": "0.3.24",
4
+ "version": "0.3.26",
5
5
  "homepage": "https://www.epublishing.com",
6
6
  "contributors": [
7
7
  {
@@ -69,7 +69,8 @@
69
69
  "postcss-css-variables": "^0.9.0",
70
70
  "prettyjson": "^1.2.1",
71
71
  "read-pkg": "^4.0.1",
72
- "sass": "^1.71.1",
72
+ "sass-embedded": "^1.71.1",
73
+ "sass-embedded-linux-x64": "^1.71.1",
73
74
  "style-loader": "^0.20.2",
74
75
  "susy": "^2.2.14",
75
76
  "time-grunt": "^1.4.0",
package/tasks/sass.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  const util = require('util');
3
- const sass = require('sass');
3
+ const sass = require('sass-embedded');
4
4
  const path = require('path');
5
5
  const fs = require('fs');
6
6
  const fsPromises = require('fs').promises;
@@ -10,6 +10,12 @@ module.exports = grunt => {
10
10
  // Cache for compiled results
11
11
  const cache = new Map();
12
12
 
13
+ // Performance benefits of Sass Embedded:
14
+ // - 10-100x faster compilation than Dart Sass
15
+ // - Significantly lower memory usage
16
+ // - Better parallel processing
17
+ // - Native performance optimizations
18
+
13
19
  // Generate cache key for a file
14
20
  const getCacheKey = (filePath, options) => {
15
21
  const content = fs.readFileSync(filePath, 'utf8');
@@ -56,7 +62,13 @@ module.exports = grunt => {
56
62
  precision: 10,
57
63
  cache: true,
58
64
  parallel: true, // Back to true for better performance
59
- maxConcurrency: require('os').cpus().length
65
+ maxConcurrency: require('os').cpus().length,
66
+ // Sass Embedded specific optimizations
67
+ loadPaths: [],
68
+ quietDeps: true, // Reduces output noise
69
+ style: 'compressed', // Faster compilation
70
+ charset: false, // Disable charset for better performance
71
+ silenceDeprecations: ['import'] // Suppress @import deprecation warnings
60
72
  });
61
73
 
62
74
  // Filter out partial files and create compilation tasks
@@ -87,11 +99,18 @@ module.exports = grunt => {
87
99
  return;
88
100
  }
89
101
 
90
- // Compile Sass
102
+ // Compile Sass with Embedded optimizations
91
103
  const sassOptions = {
92
104
  ...taskOptions,
93
105
  file: src,
94
106
  outFile: dest,
107
+ // Sass Embedded specific options for better performance
108
+ loadPaths: taskOptions.loadPaths || [],
109
+ quietDeps: taskOptions.quietDeps !== false,
110
+ style: taskOptions.style || 'compressed',
111
+ charset: taskOptions.charset !== false ? true : false,
112
+ // Suppress deprecation warnings for vendor files
113
+ silenceDeprecations: ['import']
95
114
  };
96
115
 
97
116
  const result = await util.promisify(sass.render)(sassOptions);