[PCTheme] SCSS support

This commit is contained in:
Ducko 2021-03-02 14:17:56 +00:00 committed by フズキ
parent 7f267f87a6
commit e0371211ad
No known key found for this signature in database
GPG Key ID: AD7750AB4625F1DD
3 changed files with 14 additions and 4 deletions

8
package-lock.json generated
View File

@ -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",

View File

@ -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",

View File

@ -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;