Skip to content
This repository has been archived by the owner on Jan 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #558 from chayn1k/issues/556@support/0.7.x
Browse files Browse the repository at this point in the history
Added v2/styl tech. (resolve #556)
  • Loading branch information
tadatuta committed Feb 25, 2014
2 parents fedf309 + b377f5d commit 11b5166
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions lib/techs/v2/styl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'use strict';

var PATH = require('path'),
STYLUS = require('stylus'),
Template = require('../../template');

exports.baseTechPath = PATH.join(__dirname, 'css-preprocessor');

exports.techMixin = {

getBuildResultChunk : function(relPath) {
return '@import "' + relPath + '"\n';
},

getBuildSuffixesMap: function() {
return {
'css': ['styl', 'css']
};
},

getCreateSuffixes: function() {
return ['styl'];
},

getCreateResult: function(path, suffix, vars) {

vars.Selector = '.' + vars.BlockName +
(vars.ElemName? '__' + vars.ElemName : '') +
(vars.ModName? ('_' + vars.ModName + (vars.ModVal? '_' + vars.ModVal: '')): '');

return Template.process([
'{{bemSelector}}'
],
vars);
},

compileBuildResult: function(res, defer) {
STYLUS.render(res, function(err, css) {
if (err) return defer.reject(err);

return defer.resolve([css]);
});
}

};

0 comments on commit 11b5166

Please sign in to comment.