Permalink
Browse files

Added support for KSS ~0.3.5

- Remove custom fork of KSS
- Update testcases
- Refactor kss adapter
- Doc updates
- Version Bump
  • Loading branch information...
1 parent f763fd7 commit bea1125294fc09460abeafb046791e3c883080e9 @indieisaconcept committed Feb 28, 2013
View
@@ -61,8 +61,8 @@ module.exports = function(grunt) {
name: 'Style Guide',
template: {
- src: 'kss',
- include: ['templates/kss/public/prettify.js']
+ src: 'kss'
+ // include: ['templates/kss/public/prettify.js']
}
},
View
@@ -242,6 +242,10 @@ In lieu of a formal styleguide, take care to maintain the existing coding style.
## Release History
+### 0.2.3
+
+- Styleguide nolonger uses custom node-kss fork (includes nolonger supported for KSS beware)
+
### 0.2.2
+ Grunt 0.4.0 support (~0.3.0 no longer supported)
View
@@ -1,7 +1,7 @@
{
"name": "grunt-styleguide",
"description": "Universal CSS styleguide generator for grunt",
- "version": "0.2.2",
+ "version": "0.2.3",
"homepage": "https://github.com/indieisaconcept/grunt-styleguide",
"author": {
"name": "Jonathan Barnett",
@@ -39,17 +39,18 @@
},
"dependencies": {
"grunt-lib-contrib": "~0.3.0",
- "kss": "http://github.com/indieisaconcept/kss-node/archive/599f878d4f.tar.gz",
"wrench": "~1.3.9",
"styledocco": "~0.6.1",
- "less": "~1.3.1"
+ "less": "~1.3.1",
+ "kss": "~0.3.5"
},
"keywords": [
"gruntplugin",
"scss",
"sass",
"css",
"less",
+ "stylus",
"preprocessor",
"styleguide"
]
View
@@ -7,16 +7,34 @@
* Licensed under the MIT license.
*/
+var kss = require('kss'),
+ path = require('path'),
+ base = path.dirname(require.resolve('kss')),
+ wrench = require('wrench');
+
module.exports = {
init: function (grunt) {
'use strict';
- var kss = require('kss'),
- path = require('path'),
- base = path.dirname(require.resolve('kss')),
- wrench = require('wrench');
+ var helper = require('grunt-lib-contrib').init(grunt);
+
+ // Based on handy compile function in
+ // https://github.com/gruntjs/grunt-contrib-compass/blob/master/tasks/compass.js#
+ function compile(args, cb) {
+
+ var child = grunt.util.spawn({
+ cmd: args.shift(),
+ args: args
+ }, function (error, result, code) {
+ cb(error);
+ });
+
+ child.stdout.pipe(process.stdout);
+ child.stderr.pipe(process.stderr);
+
+ }
return function (styleguide, done) {
@@ -29,45 +47,36 @@ module.exports = {
defaultTemplate = path.resolve(__dirname + '../../../templates/kss'),
missingTemplate = template.src && grunt.file.exists(defaultTemplate) ? false : !grunt.file.exists(defaultTemplate),
- argv = {};
+ args = [base + '/bin/kss-node'];
// TEMPLATE SYNC - COPY KSS TEMPLATE TO STYLEGUIDE ROOT
if (missingTemplate) {
-
grunt.file.mkdir(defaultTemplate);
wrench.copyDirSyncRecursive(kssTemplate, defaultTemplate);
grunt.log.write('- Default KSS template in use ' + grunt.util.linefeed);
grunt.log.write('- ' + defaultTemplate + grunt.util.linefeed);
- grunt.log.write('- Copy this to your project and update your gruntfile config should you wish to customise.' + grunt.util.linefeed + grunt.util.linefeed);
+ grunt.log.write('- Copy this to your project and update your gruntfile config should you wish to customise.' + grunt.util.linefeed);
}
+ options.template = (template.src.length !== 0 && template.src || defaultTemplate);
+
// set preprocessor options
- if (/(css|less)/.test(styleguide.preprocessor)) {
+ if (/(style|less|stylus|sass|css)/.test(styleguide.preprocessor)) {
if (!grunt.file.exists(files.file.src[0])) {
grunt.fail.warn('Specify an absolute path to continue');
}
- argv[styleguide.preprocessor] = files.file.src[0];
+ options[styleguide.preprocessor] = files.file.src[0];
}
- options.templateDirectory = template.src.length !== 0 && template.src || defaultTemplate;
- options.sourceDirectory = files.base;
- options.destinationDirectory = files.dest;
options.includes = template.include;
- // if we dont have a template generate one
- // and then let the user know
-
grunt.file.mkdir(files.dest);
- kss.generate(options, argv, function () {
- grunt.log.write(grunt.util.linefeed);
- done();
- });
-
+ compile(args.concat([files.base, files.dest], helper.optsToArgs(options)), done);
};
View
@@ -48,16 +48,20 @@ module.exports = function(grunt) {
collection.forEach(function (/* String */ item) {
- var extension = path.extname(item).replace('.', ''),
- location = path.relative(base, item);
+ if (grunt.file.exists(item)) {
- location = location + '?v=' + fs.statSync(item).mtime.getTime();
+ var extension = path.extname(item).replace('.', ''),
+ location = path.relative(base, item);
- resources[extension] = resources[extension] || [];
- resources[extension].push({
- url: location,
- path: item
- });
+ location = location + '?v=' + fs.statSync(item).mtime.getTime();
+
+ resources[extension] = resources[extension] || [];
+ resources[extension].push({
+ url: location,
+ path: item
+ });
+
+ }
});
@@ -167,6 +171,7 @@ module.exports = function(grunt) {
if (filePath) {
pathExists = grunt.file.exists(filePath);
styleguide.template[key] = pathExists ? filePath : grunt.file.expand(filePath);
+
} else {
styleguide.template[key] = undefined;
}
View
@@ -19,11 +19,6 @@
</head>
<body><div id="kss-wrapper">
-
- {{#each includes.css}}
- <link rel="stylesheet" href="{{this.url}}">
- {{/each}}
-
<div id="kss-nav">
<header id="kss-header">
<hgroup><h1>kss-node Styleguide</h1></hgroup>
@@ -99,11 +94,6 @@ <h1 class="kss-title"><span class="kss-ref">{{ reference }}</span> - {{ header }
<!-- SCRIPTS -->
<script src="public/kss.js"></script>
<script src="public/prettify.js"></script>
-
- {{#each includes.js}}
- <script src="{{this.url}}"></script>
- {{/each}}
-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
@@ -1,89 +0,0 @@
-
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>{{title}}</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="description" content="">
- <meta name="author" content="">
-
- <!-- Le styles -->
- {{#each includes.css}}
- <link rel="stylesheet" href="{{this.url}}">
- {{/each}}
-
- <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
- <!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
- <![endif]-->
-
- <!-- Le fav and touch icons -->
- <link rel="shortcut icon" href="assets/ico/favicon.ico">
- <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">
- <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
- <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
- <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">
-
- <script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-146052-10']);
- _gaq.push(['_trackPageview']);
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
- </script>
- </head>
-
- <body data-spy="scroll" data-target=".bs-docs-sidebar">
-
- <!-- Navbar
- ================================================== -->
- <div class="navbar navbar-inverse navbar-fixed-top">
- <div class="navbar-inner">
- <div class="container">
- <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="brand" href="./index.html">Bootstrap</a>
- <div class="nav-collapse collapse">
- {{toc}}
- </div>
- </div>
- </div>
- </div>
-
-<!-- Subhead
-================================================== -->
-<header class="jumbotron subhead" id="overview">
- <div class="container">
- <h1>{{title}}</h1>
- <p class="lead">{{description}}</p>
- </div>
-</header>
-
-<div class="container">
-
- <!-- Docs nav
- ================================================== -->
- <div class="row">
- <div class="span3 bs-docs-sidebar">
- <ul class="nav nav-list bs-docs-sidenav">
- <li><a href="#download-bootstrap"><i class="icon-chevron-right"></i> Download</a></li>
- <li><a href="#file-structure"><i class="icon-chevron-right"></i> File structure</a></li>
- <li><a href="#contents"><i class="icon-chevron-right"></i> What's included</a></li>
- <li><a href="#html-template"><i class="icon-chevron-right"></i> HTML template</a></li>
- <li><a href="#examples"><i class="icon-chevron-right"></i> Examples</a></li>
- <li><a href="#what-next"><i class="icon-chevron-right"></i> What next?</a></li>
- </ul>
- </div>
- <div class="span9">
- {{body}}
- </div>
- </div>
-
- </div>
@@ -19,9 +19,6 @@
</head>
<body><div id="kss-wrapper">
-
-
-
<div id="kss-nav">
<header id="kss-header">
<hgroup><h1>kss-node Styleguide</h1></hgroup>
@@ -247,11 +244,6 @@ <h1 class="kss-title kss-title-main"> Overview </h1>
<!-- SCRIPTS -->
<script src="public/kss.js"></script>
<script src="public/prettify.js"></script>
-
-
- <script src="../../../../templates/kss/public/prettify.js?v=1354621336000"></script>
-
-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
@@ -19,9 +19,6 @@
</head>
<body><div id="kss-wrapper">
-
-
-
<div id="kss-nav">
<header id="kss-header">
<hgroup><h1>kss-node Styleguide</h1></hgroup>
@@ -148,11 +145,6 @@ <h1 class="kss-title"><span class="kss-ref">1.1</span> - Buttons</h1>
<!-- SCRIPTS -->
<script src="public/kss.js"></script>
<script src="public/prettify.js"></script>
-
-
- <script src="../../../../templates/kss/public/prettify.js?v=1354621336000"></script>
-
-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
@@ -19,9 +19,6 @@
</head>
<body><div id="kss-wrapper">
-
-
-
<div id="kss-nav">
<header id="kss-header">
<hgroup><h1>kss-node Styleguide</h1></hgroup>
@@ -198,11 +195,6 @@ <h1 class="kss-title"><span class="kss-ref">2.1.2</span> - Label/Textbox Pairs</
<!-- SCRIPTS -->
<script src="public/kss.js"></script>
<script src="public/prettify.js"></script>
-
-
- <script src="../../../../templates/kss/public/prettify.js?v=1354621336000"></script>
-
-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
Oops, something went wrong.

0 comments on commit bea1125

Please sign in to comment.