Skip to content

gBritz/CssSyntax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CssSyntax (v0.1-alpha.0)

Css interpreter with visitor pattern

Build status Coverage Status

Install

Download by package console

install-package CssSyntax

How to using this?

Given you want know how many selectors are in your css, implement your own walker class and overriding methods you want to work:

public class SelectorCounterWalker : CssWalker
{
	public Int32 CountSelectors { get; private set; }

	protected virtual void VisitBeginSelector(string selector, int line, int column)
	{
		CountSelectors++;
	}
}

Execute walker:

var css = @"
    #edit-task { padding-top : 10px; }
    .btn {
        margin-top: 10px;
        background-image: url(../img/bk.jpg);
    }
";

var reader = new StringReader(css);
var walker = new SelectorCounterWalker();
walker.Visit(reader);

Console.WriteLine(walker.CountSelectors); //print: 2

I want to contribute!

Great! Feel free to pick one of the issues, or submit a bug/feature you would want to work on.

Please be tidy in your commits. Also, try to touch as small parts of the code as possible. This makes it easier to review and manage pull requests. Make sure your code is covered by tests, and write new ones if needed.

If you plan to do big changes or refactoring, please notify me first, so that we can discuss this in advance.

About

WIP: Css interpreter with visitor pattern

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages