Skip to content

Commit

Permalink
Build docs entirely in mix/webpack, no separate watching
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwathan committed Nov 3, 2017
1 parent 33b7e94 commit a35f77e
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 129 deletions.
28 changes: 13 additions & 15 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
{
"scripts": {
"dev": "npm run compile-css-js && ./vendor/bin/jigsaw build",
"compile-css-js": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-js": "chokidar 'source/_assets/js/**/*' --initial=true -c 'npm run compile-css-js'",
"watch-css": "chokidar 'tailwind.js' 'source/_assets/less/**/*' --initial=true -c 'npm run compile-css-js'",
"watch-templates": "chokidar 'source/**/*' --initial=true -c './vendor/bin/jigsaw build'",
"watch": "concurrently \"npm run watch-css\" \"npm run watch-js\" \"npm run watch-templates\"",
"prod": "npm run production && ./vendor/bin/jigsaw build production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
"local": "cross-env NODE_ENV=development webpack --progress --hide-modules --env=local --config=node_modules/laravel-mix/setup/webpack.config.js",
"staging": "cross-env NODE_ENV=development webpack --progress --hide-modules --env=staging --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "cross-env NODE_ENV=development webpack --progress --hide-modules --env=production --config=node_modules/laravel-mix/setup/webpack.config.js",
"dev": "npm run local",
"prod": "npm run production",
"watch": "npm run local -- --watch"
},
"private": true,
"devDependencies": {
"anchor-js": "^4.1.0",
"cross-env": "^3.2.3",
"escape-html": "^1.0.3",
"laravel-mix": "^1.5.1",
"prismjs": "^1.8.3",
"vue": "^2.5.2"
},
"dependencies": {
"chokidar-cli": "^1.2.0",
"concurrently": "^3.5.0",
"less": "^2.7.2",
"less-loader": "^4.0.5",
"lodash": "^4.17.4",
"node-cmd": "^3.0.0",
"normalize.css": "^7.0.0",
"on-build-webpack": "^0.1.0",
"postcss-cssnext": "^3.0.2",
"stylefmt": "^6.0.0"
"prismjs": "^1.8.3",
"stylefmt": "^6.0.0",
"vue": "^2.5.2",
"webpack-watch": "^0.2.0",
"yargs": "^10.0.3"
},
"browserslist": [
"> 1%"
Expand Down
19 changes: 18 additions & 1 deletion docs/webpack.mix.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
const argv = require('yargs').argv
const command = require('node-cmd')
const mix = require('laravel-mix')
const OnBuild = require('on-build-webpack')
const Watch = require('webpack-watch')
const tailwind = require('./../lib/index.js')
const config = require('./../defaultConfig.js')
const fs = require('fs')


fs.writeFileSync('./tailwind.json', JSON.stringify(config))

const env = argv.e || argv.env || 'local'
const plugins = [
new OnBuild(() => {
command.get('./vendor/bin/jigsaw build ' + env, (error, stdout, stderr) => {
console.log(error ? stderr : stdout)
})
}),
new Watch({
paths: ['source/**/*.md', 'source/**/*.php'],
options: { ignoreInitial: true }
}),
]

mix.webpackConfig({ plugins })
mix.setPublicPath('source')

mix
Expand Down
Loading

0 comments on commit a35f77e

Please sign in to comment.