This repository has been archived by the owner on Dec 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
relative import path & dependency support for stylus
- Loading branch information
Showing
7 changed files
with
45 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
var options = require('./options') | ||
var assign = require('object-assign') | ||
var path = require('path') | ||
|
||
module.exports = function (raw, cb) { | ||
module.exports = function (raw, cb, compiler, filePath) { | ||
try { | ||
var stylus = require('stylus') | ||
} catch (err) { | ||
return cb(err) | ||
} | ||
stylus.render(raw, options.stylus || {}, cb) | ||
|
||
var dir = path.dirname(filePath) | ||
var paths = [dir, process.cwd()] | ||
paths = options.stylus && options.stylus.paths | ||
? options.stylus.paths.concat(paths) | ||
: paths | ||
|
||
var renderer = stylus(raw) | ||
.set('filename', path.basename(filePath)) | ||
.set('paths', paths) | ||
|
||
renderer.render(function (err, css) { | ||
if (err) return cb(err) | ||
renderer.deps().forEach(function (file) { | ||
compiler.emit('dependency', file) | ||
}) | ||
cb(null, css) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var __vueify_style__ = require("vueify-insert-css").insert("body{font:100% Helvetica,sans-serif;color:#333}") |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$font-stack = Helvetica, sans-serif; | ||
$primary-color = #333 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<style lang="stylus"> | ||
@import './imports/import.styl' | ||
body | ||
font 100% $font-stack | ||
color $primary-color | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters