Skip to content

Commit

Permalink
Node interface and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas C. Zakas committed Jun 7, 2011
1 parent e79d973 commit 651473b
Show file tree
Hide file tree
Showing 19 changed files with 5,441 additions and 5,370 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
csslint.pnproj
csslint.pnproj
build/
38 changes: 19 additions & 19 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Copyright (c) 2011 Nicole Sullivan. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Copyright (c) 2011 Nicole Sullivan. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
28 changes: 18 additions & 10 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

<!-- the directories containing the source files -->
<property name="src.dir" value="./src" />
<property name="npm.dir" value="./npm" />

<!-- the directories and files to output to -->
<property name="build.dir" value="./build" />
<property name="build.npm.dir" value="${build.dir}/npm" />

<!-- the directory containing library files -->
<property name="lib.dir" value="./lib" />
Expand All @@ -14,7 +16,12 @@
<property name="node.build.file" value="csslint-node.js"/>
<property name="rhino.build.file" value="csslint-rhino.js"/>

<loadfile property="license.text" srcfile="LICENSE" />
<loadfile property="license.text" srcfile="LICENSE" />

<!-- clean -->
<target name="clean">
<delete dir="${build.dir}" />
</target>

<!-- build the core library -->
<target name="build.core">
Expand All @@ -36,31 +43,32 @@
</concat>
</target>

<!-- build the Node.js library -->
<!-- build the Node.js package -->
<target name="build.node">

<concat destfile="${build.dir}/${node.build.file}" fixlastline="true">
<header trimleading="yes">/*
${license.text}
*/
(function(){
</header>
<fileset dir="${lib.dir}" includes="*.js" />
<filelist dir="${src.dir}/core" files="CSSLint.js" />
<fileset dir="${src.dir}/core" includes="*.js" excludes="CSSLint.js"/>
<fileset dir="${src.dir}/rules" includes="*.js" />
<fileset dir="${src.dir}/node" includes="*.js" />
<footer trimleading="yes">
})();
exports.CSSLint = CSSLint;
</footer>
</concat>
</concat>

<mkdir dir="${build.npm.dir}"/>
<mkdir dir="${build.npm.dir}/lib"/>
<copy file="${npm.dir}/package.json" todir="${build.npm.dir}"/>
<copy file="${src.dir}/node/cli.js" todir="${build.npm.dir}"/>
<copy file="${build.dir}/${node.build.file}" todir="${build.npm.dir}/lib"/>

</target>




<!-- Build all files -->
<target name="all" depends="build.core,build.node"/>
<target name="all" depends="clean,build.core,build.node"/>

</project>
174 changes: 87 additions & 87 deletions demos/CSSLintDemo.htm
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
<!DOCTYPE html>
<html>
<head>
<title>CSSLint Demo</title>
<script type="text/javascript" src="../build/csslint.js"></script>
<style type="text/css">
.error { color: red; }
</style>
</head>
<body>
<h1>CSSLint Demo</h1>
<textarea rows="10" cols="40" id="input">
@charset "UTF-8";

@import url("booya.css") print,screen;
@import "whatup.css" screen;
@import "wicked.css";

@namespace "http://www.w3.org/1999/xhtml";
@namespace svg "http://www.w3.org/2000/svg";

li.inline {
background: url("something.png");
display: inline;
padding-left: 3px;
padding-right: 7px;
border-right: 1px dotted #066;
}

li.last {
display: inline;
padding-left: 3px !important;
padding-right: 3px;
border-right: 0px;
}

@media print {
li.inline {
color: black;
}
}

@page {
margin: 10%;
counter-increment: page;

@top-center {
font-family: sans-serif;
font-weight: bold;
font-size: 2em;
content: counter(page);
}
}
</textarea>
<input type="button" id="lint-btn" value="Run CSSLint">
<p>(You may want to keep the CSS kinda small, this could take a while.)</p>
<div id="output">

</div>
<script>
(function(){

document.body.onclick = function(event){
event = event || window.event;
var target = event.target || event.srcElement,
results, messages, i, len;

document.getElementById("output").innerHTML = "";

if (target.id == "lint-btn"){
results = CSSLint.verify(document.getElementById("input").value);
messages = results.messages;
for (i=0, len=messages.length; i < len; i++){
log(messages[i].message + " (line " + messages[i].line + ", col " + messages[i].col + ")", messages[i].type);
}

}
};

function log(value, level){
var output = document.getElementById("output");
output.innerHTML += "<span class=\"" + level + "\">" + value.replace(/ /g, "&nbsp;") + "</span><br>";
}
})();
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>CSSLint Demo</title>
<script type="text/javascript" src="../build/csslint.js"></script>
<style type="text/css">
.error { color: red; }
</style>
</head>
<body>
<h1>CSSLint Demo</h1>
<textarea rows="10" cols="40" id="input">
@charset "UTF-8";

@import url("booya.css") print,screen;
@import "whatup.css" screen;
@import "wicked.css";

@namespace "http://www.w3.org/1999/xhtml";
@namespace svg "http://www.w3.org/2000/svg";

li.inline {
background: url("something.png");
display: inline;
padding-left: 3px;
padding-right: 7px;
border-right: 1px dotted #066;
}

li.last {
display: inline;
padding-left: 3px !important;
padding-right: 3px;
border-right: 0px;
}

@media print {
li.inline {
color: black;
}
}

@page {
margin: 10%;
counter-increment: page;

@top-center {
font-family: sans-serif;
font-weight: bold;
font-size: 2em;
content: counter(page);
}
}
</textarea>
<input type="button" id="lint-btn" value="Run CSSLint">
<p>(You may want to keep the CSS kinda small, this could take a while.)</p>
<div id="output">

</div>
<script>
(function(){

document.body.onclick = function(event){
event = event || window.event;
var target = event.target || event.srcElement,
results, messages, i, len;

document.getElementById("output").innerHTML = "";

if (target.id == "lint-btn"){
results = CSSLint.verify(document.getElementById("input").value);
messages = results.messages;
for (i=0, len=messages.length; i < len; i++){
log(messages[i].message + " (line " + messages[i].line + ", col " + messages[i].col + ")", messages[i].type);
}

}
};

function log(value, level){
var output = document.getElementById("output");
output.innerHTML += "<span class=\"" + level + "\">" + value.replace(/ /g, "&nbsp;") + "</span><br>";
}
})();
</script>
</body>
</html>
43 changes: 43 additions & 0 deletions demos/demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@charset "UTF-8";

@import url("booya.css") print,screen;
@import "whatup.css" screen;
@import "wicked.css";

@namespace "http://www.w3.org/1999/xhtml";
@namespace svg "http://www.w3.org/2000/svg";

li.inline #foo {
background: url("something.png");
display: inline;
padding-left: 3px;
padding-right: 7px;
border-right: 1px dotted #066;
}

li.last.first {
display: inline;
padding-left: 3px !important;
padding-right: 3px;
border-right: 0px;
}

@media print {
li.inline {
color: black;
}


@charset "UTF-8";

@page {
margin: 10%;
counter-increment: page;

@top-center {
font-family: sans-serif;
font-weight: bold;
font-size: 2em;
content: counter(page);
}
}
Loading

0 comments on commit 651473b

Please sign in to comment.