Skip to content
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

Use parsed includeDefaultStyles instead of direct input #1130

Merged
merged 1 commit into from
Jun 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions lib/styleguide.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,6 @@ function filterFiles(files, filter) {
}

module.exports.generate = function(options) {
try {
if (options.includeDefaultStyles) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point options.includeDefaultStyles hasn't gone through common.sanitizeOptions() so the default includeDefaultStyles is false.

fs.copySync(distPath + '/css/withstyles/styleguide-app.css', distPath + '/css/styleguide-app.css');
} else {
fs.copySync(distPath + '/css/withoutstyles/styleguide-app.css', distPath + '/css/styleguide-app.css');
}
} catch (err) {
console.log('ERROR: Unable to exclude default styles.');
}
var opt = common.sanitizeOptions(options),
filesBuffer = {},
throughOpts = {
Expand All @@ -278,6 +269,16 @@ module.exports.generate = function(options) {
);
sgOptions = opt; // Copy options into global

try {
if (opt.includeDefaultStyles) {
fs.copySync(distPath + '/css/withstyles/styleguide-app.css', distPath + '/css/styleguide-app.css');
} else {
fs.copySync(distPath + '/css/withoutstyles/styleguide-app.css', distPath + '/css/styleguide-app.css');
}
} catch (err) {
console.log('ERROR: Unable to exclude default styles.');
}

function bufferFileContents(file, enc, done) {
if (file.isNull()) {
return;
Expand Down Expand Up @@ -582,4 +583,4 @@ function startServer(options) {
return serverInstance[options.port];
}

module.exports.addSection = addSection;
module.exports.addSection = addSection;