Skip to content

Commit

Permalink
Merge pull request #618 from vue-styleguidist/dev
Browse files Browse the repository at this point in the history
fix: move the build files to the right folder
  • Loading branch information
elevatebart committed Oct 30, 2019
2 parents 96c888a + 3b5aea1 commit 25f2e8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ test/cypress/videos/
/examples/*/dist/css/*.css
/examples/*/dist/index.html
/examples/*/dist/report.html
/examples/*/dist/favicon.ico

# docs generted using run.cli
/examples/*/docs/components/**/*.md
Expand Down
15 changes: 9 additions & 6 deletions packages/vue-cli-plugin-styleguidist/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const styleguidist = require('vue-styleguidist')
const merge = require('webpack-merge')

module.exports = api => {
module.exports = (api, options) => {
api.configureWebpack(() => ({
// make sure that the docs blocks
// are ignored during normal serve & build
Expand All @@ -25,7 +25,7 @@ module.exports = api => {
}
},
args => {
getStyleguidist(args, api).binutils.build()
getStyleguidist(args, api, options).binutils.build()
}
)

Expand All @@ -40,7 +40,7 @@ module.exports = api => {
},

args => {
const server = getStyleguidist(args, api).binutils.server(args.open).app
const server = getStyleguidist(args, api, options).binutils.server(args.open).app

// in order to avoid ghosted threads at the end of tests
;['SIGINT', 'SIGTERM'].forEach(signal => {
Expand Down Expand Up @@ -68,12 +68,15 @@ module.exports = api => {
)
}

function getStyleguidist(args, api) {
function getStyleguidist(args, api, options) {
const conf = api.resolve(args.config || './styleguide.config.js')
const userWebpackConfig = conf && conf.length ? require(conf).webpackConfig : {}
const sgConf = conf && conf.length ? require(conf) : {}
const userWebpackConfig = sgConf.webpackConfig
options.outputDir = sgConf.styleguideDir
const cliWebpackConfig = getConfig(api)
return styleguidist(
conf,
config => (config.webpackConfig = merge(getConfig(api), userWebpackConfig))
config => (config.webpackConfig = merge(cliWebpackConfig, userWebpackConfig))
)
}

Expand Down

0 comments on commit 25f2e8a

Please sign in to comment.