diff --git a/.eleventy.js b/.eleventy.js new file mode 100644 index 0000000..890feaa --- /dev/null +++ b/.eleventy.js @@ -0,0 +1,13 @@ +module.exports = config => { + config.setUseGitIgnore(false); + + return { + markdownTemplateEngine: 'njk', + dataTemplateEngine: 'njk', + htmlTemplateEngine: 'njk', + dir: { + input: 'src', + output: 'dist' + } + }; +}; \ No newline at end of file diff --git a/.eleventyignore b/.eleventyignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.eleventyignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9de76cf --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# Misc +*.log +npm-debug.* +*.scssc +*.swp +.DS_Store +Thumbs.db +.sass-cache +.env +.cache + +# Node modules and output +node_modules +dist +src/_includes/css \ No newline at end of file diff --git a/gulp-tasks/sass.js b/gulp-tasks/sass.js new file mode 100644 index 0000000..5f758ed --- /dev/null +++ b/gulp-tasks/sass.js @@ -0,0 +1,51 @@ +const {dest, src} = require('gulp'); +const cleanCSS = require('gulp-clean-css'); +const sassProcessor = require('gulp-sass')(require('sass')); + +// We want to be using canonical Sass, rather than node-sass +sassProcessor.compiler = require('sass'); + +// Flags whether we compress the output etc +const isProduction = process.env.NODE_ENV === 'production'; + +// An array of outputs that should be sent over to includes +const criticalStyles = ['critical.scss']; + +// Takes the arguments passed by `dest` and determines where the output file goes +const calculateOutput = ({history}) => { + // By default, we want a CSS file in our dist directory, so the + // HTML can grab it with a + let response = './dist/css'; + + // Get everything after the last slash + const sourceFileName = /[^(/|\\)]*$/.exec(history[0])[0]; + + // If this is critical CSS though, we want it to go + // to the _includes directory, so nunjucks can include it + // directly in a + +
+