diff --git a/.eleventy.js b/.eleventy.js index ea737dd..2ea4f0a 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -158,6 +158,12 @@ module.exports = function (config) { // Set static folder, which copntent will be copied to the output folder config.addPassthroughCopy({ "src/static/": "/static/" }); + // Output directory + var outputdir = "site"; + if (process.env.ELEVENTY_ENVIRONMENT == "production") { + outputdir = "dist"; + } + return { // Set custom directories for dynamic pages, data, includes, layouts and finally the generated output dir: @@ -166,7 +172,7 @@ module.exports = function (config) { layouts: "../layouts", includes: "../includes", data: "../data", - output: "dist" + output: outputdir }, // Set template formats so that other files won't be included in dist diff --git a/.gitignore b/.gitignore index 45aae1b..f4e2ec7 100644 --- a/.gitignore +++ b/.gitignore @@ -104,4 +104,4 @@ dist .tern-port # Eleventy output file -dist/ \ No newline at end of file +site/ \ No newline at end of file diff --git a/package.json b/package.json index 2baf305..a461d17 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "1.0.0", "description": "Test project for 11ty", "scripts": { - "build": "(npx postcss src/static/css/site.css -o src/static/css/output.css; npx @11ty/eleventy)", + "prod_build": "npx postcss src/static/css/site.css -o src/static/css/output.css --verbose && ELEVENTY_ENVIRONMENT=production npx @11ty/eleventy", + "build": "npx postcss src/static/css/site.css -o src/static/css/output.css && npx @11ty/eleventy", "watch": "npx @11ty/eleventy --serve", "css_watch": "npx postcss src/static/css/site.css -o src/static/css/output.css -w --verbose" },