Skip to content

Bundle CSS Lint web UI #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
siraskalot opened this issue Aug 8, 2011 · 2 comments · May be fixed by #274
Open

Bundle CSS Lint web UI #150

siraskalot opened this issue Aug 8, 2011 · 2 comments · May be fixed by #274
Labels

Comments

@siraskalot
Copy link

Please make this available so we can run this without npm. Browser extensions would be nice too! :)

@nzakas
Copy link
Contributor

nzakas commented Aug 8, 2011

FYI - you can run CSS Lint using Rhino as well (no Node required).

@mahonnaise
Copy link
Contributor

Yep, Rhino works just fine.

E.g. I got this kind of bat file in my utils directory (which was added to the PATH variable):

@java -jar <csslint dir>\lib\js.jar <csslint dir>\release\csslint-rhino.js %*

However, it isn't very usable if you want to toy around with the code or if you want to write your own rules.

I currently use this super crude thing for testing my own rules:

    <!DOCTYPE html>
    <html>
        <head>
            <title>CSS Lint</title>
            <meta charset="UTF-8"/>
        </head>
        <body>
            <textarea id="in"></textarea>
            <button type="button" id="go">go</button>
            <div id="out"></div>
            <script src="release/csslint.js"></script>
            <script>
            document.getElementById('go').addEventListener('click', function () {
                var css, result, out,
                    ruleset, enable, i, table, message;

                css = document.getElementById('in').value;
                out = document.getElementById('out');

                enable = [
                    'ids',
                    'import',
                    'st-modifier',
                    'st-capitalized-root'
                ];
                ruleset = {};
                for (i = enable.length; i--;){
                    ruleset[enable[i]] = true;
                }

                result = CSSLint.verify(css, ruleset);
                console.log(result);

                table = '<table>' +
                    '<tr><th>type</th><th>line</th><th>col</th><th>title</th><th>description</th></tr>';

                for (i = 0; i < result.messages.length; i++) {
                    message = result.messages[i];

                    table += '<tr>';

                    table += '<td>' + message.type + '</td>';
                    table += '<td>' + message.line + '</td>';
                    table += '<td>' + message.col + '</td>';
                    table += '<td>' + message.rule.name + '</td>';
                    table += '<td>' + message.message + '<br/><code>' + message.evidence + '</code></td>';

                    table += '</tr>';
                }

                table += '</table>';
                out.innerHTML = table;
            }, false);
            </script>
        </body>
    </html>

Not very pretty, but it's good enough for now.

Something like that would do the trick. Maybe it should look a little bit less awful though.

@mahonnaise mahonnaise linked a pull request May 6, 2012 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants