Skip to content

Commit a501689

Browse files
authored
Merge pull request #90 from tailwindcss/webpack-only-docs
Build docs using just webpack/mix
2 parents 2ec0e0a + a35f77e commit a501689

File tree

5 files changed

+90
-129
lines changed

5 files changed

+90
-129
lines changed

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/build_production/
12
/build_local/
23
/node_modules/
34
/vendor/

docs/package.json

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
{
22
"scripts": {
3-
"dev": "npm run compile-css-js && ./vendor/bin/jigsaw build",
4-
"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",
5-
"watch-js": "chokidar 'source/_assets/js/**/*' --initial=true -c 'npm run compile-css-js'",
6-
"watch-css": "chokidar 'tailwind.js' 'source/_assets/less/**/*' --initial=true -c 'npm run compile-css-js'",
7-
"watch-templates": "chokidar 'source/**/*' --initial=true -c './vendor/bin/jigsaw build'",
8-
"watch": "concurrently \"npm run watch-css\" \"npm run watch-js\" \"npm run watch-templates\"",
9-
"prod": "npm run production && ./vendor/bin/jigsaw build production",
10-
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
3+
"local": "cross-env NODE_ENV=development webpack --progress --hide-modules --env=local --config=node_modules/laravel-mix/setup/webpack.config.js",
4+
"staging": "cross-env NODE_ENV=development webpack --progress --hide-modules --env=staging --config=node_modules/laravel-mix/setup/webpack.config.js",
5+
"production": "cross-env NODE_ENV=development webpack --progress --hide-modules --env=production --config=node_modules/laravel-mix/setup/webpack.config.js",
6+
"dev": "npm run local",
7+
"prod": "npm run production",
8+
"watch": "npm run local -- --watch"
119
},
1210
"private": true,
1311
"devDependencies": {
1412
"anchor-js": "^4.1.0",
1513
"cross-env": "^3.2.3",
1614
"escape-html": "^1.0.3",
1715
"laravel-mix": "^1.5.1",
18-
"prismjs": "^1.8.3",
19-
"vue": "^2.5.2"
20-
},
21-
"dependencies": {
22-
"chokidar-cli": "^1.2.0",
23-
"concurrently": "^3.5.0",
2416
"less": "^2.7.2",
2517
"less-loader": "^4.0.5",
2618
"lodash": "^4.17.4",
19+
"node-cmd": "^3.0.0",
2720
"normalize.css": "^7.0.0",
21+
"on-build-webpack": "^0.1.0",
2822
"postcss-cssnext": "^3.0.2",
29-
"stylefmt": "^6.0.0"
23+
"prismjs": "^1.8.3",
24+
"stylefmt": "^6.0.0",
25+
"vue": "^2.5.2",
26+
"webpack-watch": "^0.2.0",
27+
"yargs": "^10.0.3"
3028
},
3129
"browserslist": [
3230
"> 1%"

docs/source/_layouts/master.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
</head>
2424
<body data-sidebar-visible="true" class="font-sans font-normal text-slate-darker leading-normal">
2525
@yield('body')
26+
@if ($page->production)
2627
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-109068504-1"></script>
2728
<script>
2829
window.dataLayer = window.dataLayer || [];
@@ -31,5 +32,6 @@ function gtag(){dataLayer.push(arguments);}
3132
3233
gtag('config', 'UA-109068504-1');
3334
</script>
35+
@endif
3436
</body>
3537
</html>

docs/webpack.mix.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1+
const argv = require('yargs').argv
2+
const command = require('node-cmd')
13
const mix = require('laravel-mix')
4+
const OnBuild = require('on-build-webpack')
5+
const Watch = require('webpack-watch')
26
const tailwind = require('./../lib/index.js')
37
const config = require('./../defaultConfig.js')
48
const fs = require('fs')
59

6-
710
fs.writeFileSync('./tailwind.json', JSON.stringify(config))
811

12+
const env = argv.e || argv.env || 'local'
13+
const plugins = [
14+
new OnBuild(() => {
15+
command.get('./vendor/bin/jigsaw build ' + env, (error, stdout, stderr) => {
16+
console.log(error ? stderr : stdout)
17+
})
18+
}),
19+
new Watch({
20+
paths: ['source/**/*.md', 'source/**/*.php'],
21+
options: { ignoreInitial: true }
22+
}),
23+
]
24+
25+
mix.webpackConfig({ plugins })
926
mix.setPublicPath('source')
1027

1128
mix

0 commit comments

Comments
 (0)