Skip to content

Commit

Permalink
changes for stylecow-parser 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Apr 19, 2015
1 parent f3468b5 commit 24d9d61
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 30 deletions.
24 changes: 0 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Deployed apps should consider commenting this line out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules

.DS_Store
10 changes: 5 additions & 5 deletions bin/stylecow
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function run (configFile, watch, liveReload) {

//Converts the code and output the result
function executeConvert (config, file) {
var css = stylecow.Root.create(stylecow.Reader.fromFile(file.input));
var css = stylecow.parseFile(file.input);

//Convert the code
stylecow.run(css);
Expand All @@ -244,10 +244,10 @@ function executeConvert (config, file) {
var url = require('url');
var basepath = path.dirname(file.baseUrl);

css.search({
css.getAll({
type: 'Function',
name: 'url'
}).search({
}).getAll({
type: ['Keyword', 'String']
}).forEach(function (keyword) {
if (!url.parse(keyword.name).hostname && (keyword.name[0] !== '/')) {
Expand Down Expand Up @@ -440,10 +440,10 @@ function getFiles (css) {
nodes.push(css);

nodes.filter(function (child) {
return (child._data && child._data['sourceFile']);
return ('file' in child.data) && child.data.file;
})
.map(function (child) {
return child._data['sourceFile'];
return child.data.file;
})
.forEach(function (file) {
files[path.normalize(file)] = null;
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function executeTasks (element, tasks) {
}

tasks.forEach(function (task) {
if (!task.filter || element.is(task.filter)) {
if (element.parent && (!task.filter || element.is(task.filter))) {
task.fn(element);
}
});
Expand Down

0 comments on commit 24d9d61

Please sign in to comment.