mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 16:47:26 +02:00
Update how separate css files are identified
This commit is contained in:
parent
fc4e5b05df
commit
b359a2500d
3 changed files with 29 additions and 6 deletions
|
@ -56,6 +56,18 @@ function execute() {
|
|||
return rawContent.replace(TABLE_OF_CONTENTS_TOKEN, tableOfContents);
|
||||
};
|
||||
|
||||
function isSeparateCss(file) {
|
||||
if (!siteConfig.separateCss) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < siteConfig.separateCss.length; i++) {
|
||||
if (file.includes(siteConfig.separateCss[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log("generate.js triggered...");
|
||||
|
||||
const regexSubFolder = /docs\/(.*)\/.*/;
|
||||
|
@ -255,10 +267,7 @@ function execute() {
|
|||
/* copy all static files from user */
|
||||
files = glob.sync(CWD + "/static/**");
|
||||
files.forEach(file => {
|
||||
if (
|
||||
file.match(/\.css$/) &&
|
||||
siteConfig.separateCss.indexOf(path.basename(file)) == -1
|
||||
) {
|
||||
if (file.match(/\.css$/) && !isSeparateCss(file)) {
|
||||
const mainCss =
|
||||
__dirname +
|
||||
"/../../build" +
|
||||
|
|
|
@ -111,6 +111,20 @@ function execute(port) {
|
|||
|
||||
/****************************************************************************/
|
||||
|
||||
function isSeparateCss(file) {
|
||||
if (!siteConfig.separateCss) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < siteConfig.separateCss.length; i++) {
|
||||
if (file.includes(siteConfig.separateCss[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
console.log("server.js triggered...");
|
||||
|
||||
reloadMetadataCategories();
|
||||
|
@ -354,7 +368,7 @@ function execute(port) {
|
|||
let files = glob.sync(CWD + "/static/**/*.css");
|
||||
|
||||
files.forEach(file => {
|
||||
if (siteConfig.separateCss.indexOf(path.basename(file)) != -1) {
|
||||
if (isSeparateCss(file)) {
|
||||
return;
|
||||
}
|
||||
cssContent =
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"shelljs": "^0.7.8"
|
||||
},
|
||||
"name": "docusaurus",
|
||||
"version": "1.0.0-alpha.25",
|
||||
"version": "1.0.0-alpha.26",
|
||||
"bin": {
|
||||
"docusaurus-start": "./lib/start-server.js",
|
||||
"docusaurus-build": "./lib/build-files.js",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue