Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Nov 11, 2020
1 parent 49f98c9 commit fd13ee3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
15 changes: 11 additions & 4 deletions build/build-css.js
Expand Up @@ -5,10 +5,13 @@ const path = require('path')
const postcss = require('postcss')
const glob = require('glob')
const sass = require('sass')
const autoprefixer = require('autoprefixer')
const fiber = require('fibers')
const Cleancss = require('clean-css')

const postcssConfig = require('./postcss.config')
const postcssPlugins = [
autoprefixer({ cascade: false })
]

const files = [
'bootstrap',
Expand All @@ -27,10 +30,14 @@ files.forEach(filename => {
outFile: `./dist/css/${filename}.css`
}, (error, css) => {
// Fix postcss to use and output sourcemaps
postcss(postcssConfig)
.process(css.css, { from: `./dist/css/${filename}.css` })
postcss(postcssPlugins)
.process(css.css, {
from: `./dist/css/${filename}.css`,
map: `./dist/css/${filename}.css.map`
})
.then(result => {
fs.writeFile(`./dist/css/${filename}.css`, result.css, () => true)
fs.writeFile(`./dist/css/${filename}.css.map`, result.map.toString(), () => true)
fs.writeFile(`./dist/css/${filename}.min.css`, new Cleancss().minify(result.css).styles, () => true)
})
})
Expand All @@ -40,7 +47,7 @@ files.forEach(filename => {
glob('./site/content/**/*.css', {}, (error, files) => {
files.forEach(file => {
fs.readFile(file, (err, css) => {
postcss(postcssConfig)
postcss(postcssPlugins)
.process(css, { from: file, to: file })
.then(result => {
if (css.toString('utf8') !== result.css) {
Expand Down
9 changes: 0 additions & 9 deletions build/postcss.config.js

This file was deleted.

0 comments on commit fd13ee3

Please sign in to comment.