diff options
initial commit
Diffstat (limited to 'src/css.11ty.js')
-rw-r--r-- | src/css.11ty.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/css.11ty.js b/src/css.11ty.js new file mode 100644 index 0000000..a3ef254 --- /dev/null +++ b/src/css.11ty.js @@ -0,0 +1,37 @@ +const fs = require('fs') +const path = require('path') +const postcss = require('postcss') + +module.exports = class { + async data() { + return { + inputs: [ + 'index.css', + 'prism.css' + ], + + pagination: { + data: 'inputs', + alias: 'inputfiles', + size: 1 + }, + + permalink: ({ inputfiles }) => `/${inputfiles}`, + + eleventyExcludeFromCollections: true + } + }; + + async render({ inputfiles}) { + const inputfile = path.join(__dirname, inputfiles); + return await postcss([ + require('postcss-import'), + require('autoprefixer'), + require('cssnano') + ]) + .process(await fs.readFileSync(inputfile), { + from: inputfile + }) + .then(result => result.css) + }; +} |