diff --git a/compile-pug.js b/compile-pug.js index 4589b01d04d402e150e2eb683e976cd9c16f160d..ddb3ba2056e5191c5201e294e4d005f2bf98fb82 100644 --- a/compile-pug.js +++ b/compile-pug.js @@ -8,12 +8,15 @@ const chokidar = require('chokidar') //Set default language const default_lang = 'en' -const pugFile = './src/index.pug' +const pugDir = './src' +const pugFile = `${pugDir}/index.pug` //Set the translation directory const dataDir = './translation' const outDir = './www' +const paramFile = './src/config.json' + //Compile custom function async function compile() { //Retrieve langues proposed @@ -41,7 +44,7 @@ async function compile() { ) } - const options = JSON.parse(await fs.readFile('./src/config.json', 'utf-8')) + const options = JSON.parse(await fs.readFile(paramFile, 'utf-8')) const pugFct = pug.compileFile(pugFile) await fs.mkdir(outDir, { recursive: true }) @@ -64,7 +67,7 @@ async function compile() { compile().then(() => { if (!process.argv.includes('-w') && !process.argv.includes('--watch')) return console.log('watching for changes…') - chokidar.watch([pugFile, dataDir]).on('change', editedFilePath => { + chokidar.watch([`${pugDir}/**/*.pug`, `${dataDir}/**/*.yml`, paramFile]).on('change', editedFilePath => { console.log(`\nchanged: ${editedFilePath}`) compile() }) diff --git a/package.json b/package.json index c0eded1870a636c860ecb365eb7515dc68d96459..a838486e5bd3573eb58ff22cbc02fda8698459d4 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,11 @@ { - "name": "Coop-starter", + "name": "coop-starter", "version": "1.0.0", "license": "MIT", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "scss": "node-sass -w ./src/styles/index.scss -o ./www/styles/", "pug": "node ./compile-pug.js -w", - "pugprod": "pug ./src/index.pug --out ./www/ --obj prod.json", "copy-js": "cp ./src/scripts/*.js ./www/scripts/", "copy-fonts": "cp -R ./src/fonts ./www", "copy-images": "cp -R ./src/images ./www", diff --git a/src/get_config.pug b/src/get_config.pug deleted file mode 100644 index d2fd8950071161ce9bac35a518ac026d43a488cb..0000000000000000000000000000000000000000 --- a/src/get_config.pug +++ /dev/null @@ -1,7 +0,0 @@ -- var __env = locals[process.env.ENV] - -- - for(k in __env){ - eval(`var ${k} = __env[${JSON.stringify(k)}]`); - } -