Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'refs/heads/css-preproc' into devel

  • Loading branch information...
commit df13b724f8c45864c8633b4f6e9ace73903c3e0f 2 parents 234827b + 896775c
Nick Martin n1mmy authored
25 LICENSE.txt
View
@@ -458,6 +458,31 @@ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
+----------
+stylus: https://github.com/learnboost/stylus
+----------
+
+Copyright (c) 2010 LearnBoost <dev@learnboost.com>
+
+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.
+
+
+----------
+sass: https://github.com/visionmedia/sass.js
+----------
+
+Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
+
+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.
+
--------------
Apache License
--------------
2  docs/client/docs.js
View
@@ -175,6 +175,8 @@ var toc = [
"coffeescript",
"jquery",
"less",
+ "sass",
+ "stylus",
"showdown",
"underscore"
] ],
2  docs/client/packages.html
View
@@ -21,6 +21,8 @@ <h1 id="packages">Packages</h1>
{{> pkg_coffeescript}}
{{> pkg_jquery}}
{{> pkg_less}}
+{{> pkg_sass}}
+{{> pkg_stylus}}
{{> pkg_showdown}}
{{> pkg_underscore}}
16 docs/client/packages/sass.html
View
@@ -0,0 +1,16 @@
+<template name="pkg_sass">
+{{#better_markdown}}
+## `sass`
+
+Sass is a CSS pre-processor with a minimal syntax and powerful dynamic
+expresions. With the `sass` package installed, `.sass` files in your
+application are automatically compiled to CSS and the results are
+included in the client CSS bundle.
+
+See <a href="https://github.com/visionmedia/sass.js">https://github.com/visionmedia/sass.js</a>
+for the JavaScript implementation of the Sass language
+and <a href="http://sass-lang.com/">http://sass-lang.com/</a> for the
+original project.
+
+{{/better_markdown}}
+</template>
17 docs/client/packages/stylus.html
View
@@ -0,0 +1,17 @@
+<template name="pkg_stylus">
+{{#better_markdown}}
+## `stylus`
+
+Stylus is a CSS pre-processor with a simple syntax and expressive
+dynamic behavior. It allows for more compact stylesheets and
+helps reduce code duplication in CSS files.
+
+With the `stylus` package installed, `.styl` files in your application are
+automatically compiled to CSS and the results are included in the client
+CSS bundle.
+
+See <a href="http://learnboost.github.com/stylus/">http://learnboost.github.com/stylus</a>
+for documentation of the Stylus language.
+
+{{/better_markdown}}
+</template>
33 packages/sass/package.js
View
@@ -0,0 +1,33 @@
+Package.describe({
+ summary: "Sassy CSS pre-processor."
+});
+
+var sass = require('sass');
+var fs = require('fs');
+
+Package.register_extension(
+ "sass", function (bundle, source_path, serve_path, where) {
+ serve_path = serve_path + '.css';
+
+ try {
+ var contents = fs.readFileSync(source_path);
+ var css = sass.render(contents.toString('utf8'));
+ // NOTE: sass does not seem to return any sort of error. It just
+ // silently ignores bad sass code.
+
+ bundle.add_resource({
+ type: "css",
+ path: serve_path,
+ data: new Buffer(css),
+ where: where
+ });
+ } catch (e) {
+ // Haven't been able to get sass to throw, but just in case.
+ bundle.error(source_path + ": Sass compiler error: " + e.message);
+ }
+ }
+);
+
+Package.on_test(function (api) {
+ api.add_files(['sass_tests.sass', 'sass_tests.js'], 'client');
+});
20 packages/sass/sass_tests.js
View
@@ -0,0 +1,20 @@
+
+Tinytest.add("sass - presence", function(test) {
+
+ // find the .sass stylesheet, whose first rule contains "sass-tests"
+ // in the selector
+ var sheet = _.find(document.styleSheets, function(sh) {
+ var rules = sh.cssRules || sh.rules;
+ return /sass-tests/.test(rules[0].selectorText);
+ });
+
+ test.isTrue(sheet);
+
+ // `cssRules` is the W3C name, but isn't supported in IE until
+ // version 9. IE<=8 has `rules`. We prefer `cssRules` as
+ // it is less likely to have quirks if both are present.
+ var rules = sheet.cssRules || sheet.rules;
+
+ test.equal(rules[1].style.borderLeftWidth, "13px");
+});
+
7 packages/sass/sass_tests.sass
View
@@ -0,0 +1,7 @@
+#sass-tests
+ :zoom 1
+
+unlucky: 13px
+
+.unlucky-left-border
+ :border-left-width !unlucky
31 packages/stylus/package.js
View
@@ -0,0 +1,31 @@
+Package.describe({
+ summary: 'Expressive, dynamic, robust CSS.'
+});
+
+var stylus = require('stylus');
+var fs = require('fs');
+
+Package.register_extension(
+ 'styl', function(bundle, source_path, serve_path, where) {
+ serve_path = serve_path + '.css';
+
+ var contents = fs.readFileSync(source_path);
+
+ stylus.render(contents.toString('utf8'), { filename: source_path }, function(err, css) {
+ if (err) {
+ bundle.error('Stylus compiler error: ' + err.message);
+ return;
+ }
+ bundle.add_resource({
+ type: 'css',
+ path: serve_path,
+ data: new Buffer(css),
+ where: where
+ });
+ });
+ }
+);
+
+Package.on_test(function (api) {
+ api.add_files(['stylus_tests.styl', 'stylus_tests.js'], 'client');
+});
20 packages/stylus/stylus_tests.js
View
@@ -0,0 +1,20 @@
+// based on packages/less/less_tests.js
+Tinytest.add("stylus - presence", function(test) {
+
+ // find the .styl stylesheet, whose first rule contains "stylus-tests"
+ // in the selector
+ var sheet = _.find(document.styleSheets, function(sh) {
+ var rules = sh.cssRules || sh.rules;
+ return /stylus-tests/.test(rules[0].selectorText);
+ });
+
+ test.isTrue(sheet);
+
+ // `cssRules` is the W3C name, but isn't supported in IE until
+ // version 9. IE<=8 has `rules`. We prefer `cssRules` as
+ // it is less likely to have quirks if both are present.
+ var rules = sheet.cssRules || sheet.rules;
+
+ test.equal(rules[1].style.borderLeftWidth, "13px");
+});
+
9 packages/stylus/stylus_tests.styl
View
@@ -0,0 +1,9 @@
+
+#stylus-tests
+ zoom: 1
+
+unlucky = 13px
+
+.unlucky-left-border
+ border-left-width: unlucky
+
Please sign in to comment.
Something went wrong with that request. Please try again.