Skip to content

Commit a30663e

Browse files
committed
Fix issues with styleguide assets
1 parent 89f3087 commit a30663e

File tree

8 files changed

+69
-57
lines changed

8 files changed

+69
-57
lines changed

config/project.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ const config = {
2121
dir_test : 'tests',
2222
dir_styleguide : 'dist/styleguide',
2323

24+
// ----------------------------------
25+
// Styleguide Configuration
26+
// ----------------------------------
27+
styleguide_enabled : true,
28+
styleguide_version : '0.0.1',
29+
styleguide_title : 'Caxy Front End Starter Kit Style Guide',
30+
styleguide_hide_pattern_status: true,
31+
2432
// ----------------------------------
2533
// Server Configuration
2634
// ----------------------------------
@@ -118,7 +126,7 @@ config.paths = {
118126
client : base.bind(null, config.dir_client),
119127
public : base.bind(null, config.dir_public),
120128
dist : base.bind(null, config.dir_dist),
121-
styleguide : base.bind(null, config.dir_styleguide)
129+
styleguideOutput : base.bind(null, config.dir_styleguide)
122130
};
123131

124132
// ========================================================

config/styleguide.config.js

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,47 @@
11
const project = require('../config/project.config');
2-
const builder = require('kss-caxy-zaba-template');
32

3+
/**
4+
* Configuration object for the kss-node styleguide.
5+
*
6+
* This config is passed into StyleguidePlugin (caxy-styleguide-webpack-plugin) in webpack.config.js
7+
* when the styleguide is enabled.
8+
*/
49
const styleguideConfig = {
5-
source: [
6-
project.paths.client('styles'),
7-
project.paths.client('styleguide/pattern-markup'),
8-
project.paths.client('styleguide/project-assets')
10+
// Project-specific settings pulled from project.config.js.
11+
styleguide_version: project.styleguide_version,
12+
title: project.styleguide_title,
13+
hide_pattern_status: project.styleguide_hide_pattern_status,
14+
destination: project.paths.styleguideOutput(),
15+
16+
// Source directories for KSS documentation.
17+
source: [
18+
project.paths.client('styles'),
19+
project.paths.client('styleguide/pattern-markup'),
20+
project.paths.client('styleguide/project-assets')
21+
],
22+
23+
// Custom SASS files to be included in styleguide, but not application.
24+
sass: {
25+
files: [
26+
project.paths.client('styleguide/project-assets/_project-specific.scss')
927
],
10-
sass: {
11-
files: [
12-
project.paths.client('styleguide/project-assets/_project-specific.scss')
13-
],
14-
includePaths: [
15-
project.paths.base('node_modules'),
16-
project.paths.client('styles')
17-
]
18-
},
19-
styleguide_version: '0.0.1',
20-
destination: project.paths.dist('styleguide'),
21-
title: 'Caxy Front End Starter Kit Styleguide',
22-
hide_pattern_status: true,
23-
builder: project.paths.base('node_modules/kss-caxy-zaba-template/src'),
24-
custom: [
25-
'devnotes',
26-
'hidemarkup',
27-
'status',
28-
'patterntype',
29-
'containspatterns'
28+
includePaths: [
29+
project.paths.base('node_modules'),
30+
project.paths.client('styles')
3031
]
32+
},
33+
34+
// Use the kss-caxy-zaba-template as the builder.
35+
builder: project.paths.base('node_modules/kss-caxy-zaba-template'),
36+
37+
// Custom kss-node plugins.
38+
custom: [
39+
'devnotes',
40+
'hidemarkup',
41+
'status',
42+
'patterntype',
43+
'containspatterns'
44+
]
3145
};
3246

3347
module.exports = styleguideConfig;

config/webpack.config.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
55
const ExtractTextPlugin = require('extract-text-webpack-plugin');
66
const project = require('./project.config');
77
const debug = require('debug')('app:config:webpack');
8-
const StyleguidePlugin = require('caxy-styleguide-webpack-plugin');
9-
const styleguideConfig = require('./styleguide.config');
108

119
// Helper variables to determine the environment.
1210
const __DEV__ = project.globals.__DEV__;
@@ -67,10 +65,17 @@ webpackConfig.plugins = [
6765
minify : {
6866
collapseWhitespace : true
6967
}
70-
}),
71-
new StyleguidePlugin(styleguideConfig)
68+
})
7269
];
7370

71+
// Add StyleguidePlugin if styleguide is enabled.
72+
if (project.styleguide_enabled) {
73+
const StyleguidePlugin = require('caxy-styleguide-webpack-plugin');
74+
const styleguideConfig = require('./styleguide.config');
75+
76+
webpackConfig.plugins.push(new StyleguidePlugin(styleguideConfig));
77+
}
78+
7479
// Ensure that the compiler exits on errors during testing so that
7580
// they do not get skipped and misreported.
7681
if (__TEST__ && !argv.watch) {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@
7474
"bugs": "https://github.com/caxy/front-end-starter-kit/issues",
7575
"homepage": "https://github.com/caxy/front-end-starter-kit#readme",
7676
"dependencies": {
77-
"normalize-css": "^2.3.1",
78-
"caxy-styleguide-webpack-plugin": "^0.0.2",
79-
"kss-caxy-zaba-template": "^0.0.2"
77+
"caxy-styleguide-webpack-plugin": "^0.0.4",
78+
"kss-caxy-zaba-template": "^0.0.5",
79+
"normalize-css": "^2.3.1"
8080
},
8181
"devDependencies": {
8282
"babel-core": "^6.22.1",

server/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ if (project.env === 'development') {
4747
app.use(express.static(project.paths.public()));
4848

4949
// Serve the KSS styleguide as static assets.
50-
app.use('/styleguide', express.static(project.paths.styleguide()));
50+
app.use('/styleguide', express.static(project.paths.styleguideOutput()));
5151

5252
// This rewrites all routes requests to the root /index.html file
5353
// (ignoring file requests). If you want to implement universal

src/styleguide/project-assets/_project-specific.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import 'caxy-styleguide-core/src/styleguide/caxy-zaba-template/scss/_mixins-styleguide.scss';
1+
@import '~kss-caxy-zaba-template/scss/_mixins-styleguide.scss';
22

33
// ------------------------------------------------------------------------------
44
// Project Specific Settings

src/styleguide/project-assets/homepage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Welcome to the Caxy Boilerplate Style Guide
1+
# Welcome to the Caxy Front End Starter Kit Style Guide
22

33
A record of patterns and components will be maintained here as they are
44
added to the style guide, grouped by version number.

yarn.lock

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -779,23 +779,9 @@ caseless@~0.11.0:
779779
version "0.11.0"
780780
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7"
781781

782-
caxy-styleguide-core@^0.0.2:
783-
version "0.0.2"
784-
resolved "https://registry.yarnpkg.com/caxy-styleguide-core/-/caxy-styleguide-core-0.0.2.tgz#07924902bc89e7a0eb446d447e6a38f5eb73b81d"
785-
dependencies:
786-
debug "^2.6.0"
787-
fs-extra "^2.0.0"
788-
kss "^3.0.0-beta.17"
789-
node-sass "^4.3.0"
790-
normalize-css "^2.3.1"
791-
path "^0.12.7"
792-
793-
caxy-styleguide-webpack-plugin@^0.0.2:
794-
version "0.0.2"
795-
resolved "https://registry.yarnpkg.com/caxy-styleguide-webpack-plugin/-/caxy-styleguide-webpack-plugin-0.0.2.tgz#61c7dbb2d2709e7acf6ad25bc8d0255ab975f228"
796-
dependencies:
797-
caxy-styleguide-core "^0.0.2"
798-
kss "^3.0.0-beta.17"
782+
caxy-styleguide-webpack-plugin@^0.0.4:
783+
version "0.0.4"
784+
resolved "https://registry.yarnpkg.com/caxy-styleguide-webpack-plugin/-/caxy-styleguide-webpack-plugin-0.0.4.tgz#c54ff39099ed8094a21cf53ad1fc6094e8ebc9ce"
799785

800786
center-align@^0.1.1:
801787
version "0.1.3"
@@ -2394,12 +2380,11 @@ klaw@^1.0.0:
23942380
optionalDependencies:
23952381
graceful-fs "^4.1.9"
23962382

2397-
kss-caxy-zaba-template@^0.0.2:
2398-
version "0.0.2"
2399-
resolved "https://registry.yarnpkg.com/kss-caxy-zaba-template/-/kss-caxy-zaba-template-0.0.2.tgz#b466d5ae9cc751e529704012e45ced31a9dea264"
2383+
kss-caxy-zaba-template@^0.0.5:
2384+
version "0.0.5"
2385+
resolved "https://registry.yarnpkg.com/kss-caxy-zaba-template/-/kss-caxy-zaba-template-0.0.5.tgz#6d704cbab4a5c1758eea5213ba1945386ea45101"
24002386
dependencies:
24012387
fs-extra "^2.0.0"
2402-
kss "^3.0.0-beta.17"
24032388
node-sass "^4.3.0"
24042389
path "^0.12.7"
24052390

0 commit comments

Comments
 (0)