Skip to content

Commit

Permalink
Refactor stylus building
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Oct 15, 2015
1 parent 3ad5560 commit ed560aa
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/build_css.js
Expand Up @@ -3,12 +3,17 @@
const join = require('path').join
const readFileSync = require('fs').readFileSync

const stylus = require('stylus')
const postcss = require('postcss')
const autoprefixer = require('autoprefixer')({})

module.exports = function buildCss (options, done) {
buildStylus(join(__dirname, '../data/style.styl'), done)
}

function buildStylus (filepath, done) {
try {
const stylus = require('stylus')
const postcss = require('postcss')
const autoprefixer = require('autoprefixer')({})
let data = readFileSync(join(__dirname, '../data/style.styl'), 'utf-8')
let data = readFileSync(filepath, 'utf-8')

// if (options.before) {
// data = data.replace('// :before:\n',
Expand All @@ -19,10 +24,8 @@ module.exports = function buildCss (options, done) {
// }

stylus(data)
.set('filename', join(__dirname, '../data/style.styl'))
.set('filename', filepath)
.include(join(__dirname, '../node_modules'))
// .set('compress', true)
// .import
.render((err, result) => {
if (err) return done(err)
let css = result
Expand Down

0 comments on commit ed560aa

Please sign in to comment.