Browse Source

[PCTheme] SCSS support

main
Ducko 3 months ago
committed by フズキ
parent
commit
e0371211ad
No known key found for this signature in database GPG Key ID: AD7750AB4625F1DD
  1. 8
      package-lock.json
  2. 3
      package.json
  3. 7
      src/preprocessors/pcTheme.js

8
package-lock.json

@ -12278,6 +12278,14 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"sass": {
"version": "1.32.8",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.32.8.tgz",
"integrity": "sha512-Sl6mIeGpzjIUZqvKnKETfMf0iDAswD9TNlv13A7aAF3XZlRPMq4VvJWBC2N2DXbp94MQVdNSFG6LfF/iOXrPHQ==",
"requires": {
"chokidar": ">=2.0.0 <4.0.0"
}
},
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",

3
package.json

@ -19,7 +19,8 @@
"dependencies": {
"axios": "^0.21.1",
"glob": "^7.1.6",
"parcel-bundler": "^1.12.4"
"parcel-bundler": "^1.12.4",
"sass": "^1.32.8"
},
"alias": {
"@goosemod/patcher": "./moduleWrappers/goosemod/patcher.js",

7
src/preprocessors/pcTheme.js

@ -1,4 +1,5 @@
import { readFileSync, writeFileSync, mkdirSync, rmSync } from 'fs';
import sass from 'sass';
export default (manifestPath, repo) => {
const pcManifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
@ -11,7 +12,7 @@ export default (manifestPath, repo) => {
description: pcManifest.description,
version: pcManifest.version,
authors: [pcManifest.author],
authors: [ pcManifest.author ]
};
rmSync(manifestPath);
@ -20,7 +21,7 @@ export default (manifestPath, repo) => {
if (pcManifest.theme.split('.').pop() === 'scss') {
const cssPath = pcManifest.theme.split('.').slice(0, -1).concat('css').join('.');
const compiled = sass.renderSync({ file: pcManifest.theme }).css;
const compiled = (sass.renderSync({ file: pcManifest.theme })).css;
writeFileSync(cssPath, compiled);
pcManifest.theme = cssPath;
@ -42,7 +43,7 @@ export default {
)
);
},
onRemove: async () => {
style.remove();
},

Loading…
Cancel
Save