@epublishing/grunt-epublishing 0.3.14 → 0.3.16
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/lib/configure-sass.js +31 -2
- package/package.json +1 -1
package/lib/configure-sass.js
CHANGED
|
@@ -4,13 +4,42 @@
|
|
|
4
4
|
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
7
|
-
const sass
|
|
8
|
-
const
|
|
7
|
+
const sass = require('sass');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
const sassAliases = {
|
|
11
|
+
'^compass': function (url) {
|
|
12
|
+
return path.join(
|
|
13
|
+
process.cwd(),
|
|
14
|
+
'node_modules',
|
|
15
|
+
'compass-mixins',
|
|
16
|
+
'lib',
|
|
17
|
+
url
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
'^bourbon$': 'bourbon/app/assets/stylesheets/bourbon',
|
|
21
|
+
'^breakpoint$': 'breakpoint-sass/stylesheets/breakpoint',
|
|
22
|
+
'^susyone$': 'susy/sass/susyone'
|
|
23
|
+
};
|
|
9
24
|
|
|
10
25
|
module.exports = function configureSass(config) {
|
|
11
26
|
|
|
12
27
|
config.sass.options.implementation = sass;
|
|
13
28
|
|
|
29
|
+
config.sass.options.importer = (url, prev, done) => {
|
|
30
|
+
for (const key in sassAliases) {
|
|
31
|
+
const pattern = new RegExp(key);
|
|
32
|
+
const alias = sassAliases[key];
|
|
33
|
+
|
|
34
|
+
if (pattern.test(url)) {
|
|
35
|
+
const value = alias instanceof Function ? alias(url) : alias;
|
|
36
|
+
return done({ file: value });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return done({ file: url });
|
|
41
|
+
}
|
|
42
|
+
|
|
14
43
|
|
|
15
44
|
return config;
|
|
16
45
|
};
|
package/package.json
CHANGED