Use Laravel Mix

This commit is contained in:
Oliver Davies 2019-11-12 09:45:06 +00:00
parent ee18292499
commit c418a1b8d6
21 changed files with 11079 additions and 7274 deletions

View file

@ -1,20 +1,27 @@
h1, h2, h3 h1, h2, h3 {
@apply font-bold @apply font-bold
}
h1 h1 {
@apply text-3xl @apply text-3xl
}
h2 h2 {
@apply text-2xl @apply text-2xl
}
img img {
@apply max-w-full h-auto @apply max-w-full h-auto
}
a a {
@apply text-blue-700 no-underline @apply text-blue-700 no-underline;
&:hover &:hover {
@apply underline @apply underline
}
}
blockquote blockquote {
@apply border-l-4 border-blue-600 pl-4 px-6 py-2 @apply border-l-4 border-blue-600 pl-4 px-6 py-2
}

View file

@ -1,10 +1,13 @@
.button .button {
@apply bg-blue-600 border-blue-600 border inline-block text-white no-underline py-2 px-3 rounded text-sm @apply bg-blue-600 border-blue-600 border inline-block text-white no-underline py-2 px-3 rounded text-sm;
&:focus &:focus {
@apply py-2 px-3 m-0 @apply py-2 px-3 m-0
}
&:active, &:active,
&:focus, &:focus,
&:hover &:hover {
@apply bg-white text-blue-600 @apply bg-white text-blue-600
}
}

View file

@ -1,2 +1,3 @@
.container .container {
@apply w-full max-w-5xl px-4 mx-auto @apply w-full max-w-5xl px-4 mx-auto
}

View file

@ -1,3 +1,5 @@
p.lead p.lead {
@screen md @screen md {
@apply text-lg @apply text-lg
}
}

View file

@ -1,16 +1,19 @@
.markup .markup {
@apply leading-normal @apply leading-normal;
h2, h2,
h3, h3,
h4 h4 {
@apply text-black font-bold mb-3 @apply text-black font-bold mb-3
}
h2 h2 {
@apply mt-8 mb-3 @apply mt-8 mb-3
}
h3 h3 {
@apply text-lg mt-8 @apply text-lg mt-8
}
p, p,
ul, ul,
@ -19,28 +22,38 @@
table, table,
figure, figure,
pre, pre,
[v-pre] [v-pre] {
&:not(:last-child) &:not(:last-child) {
@apply mb-6 @apply mb-6
}
}
ul ul {
@apply list-disc ml-5 @apply list-disc ml-5
}
code code {
@apply bg-gray-200 font-mono text-sm @apply bg-gray-200 font-mono text-sm
}
p, p,
li li {
code code {
@apply inline-block border border-gray-300 font-bold mx-px p-1 leading-none @apply inline-block border border-gray-300 font-bold mx-px p-1 leading-none
}
}
pre code, pre code,
.hljs .hljs {
@apply block leading-loose overflow-x-scroll p-6 @apply block leading-loose overflow-x-scroll p-6
}
figure, figure,
img img {
@apply block @apply block
}
figcaption figcaption {
@apply italic text-sm text-gray-800 text-center mb-0 mt-1 @apply italic text-sm text-gray-800 text-center mb-0 mt-1
}
}

View file

@ -1,11 +1,15 @@
.note .note {
@apply bg-blue-200 border-blue-600 border-l-4 mb-4 p-4 rounded @apply bg-blue-200 border-blue-600 border-l-4 mb-4 p-4 rounded;
> *:not(:first-child) > *:not(:first-child) {
@apply mt-6 @apply mt-6
}
p a p a {
@apply text-black underline @apply text-black underline;
&:hover &:hover {
@apply no-underline @apply no-underline
}
}
}

View file

@ -1,13 +1,18 @@
.table .table {
@apply w-full @apply w-full;
th th {
@apply bg-gray-200 text-left @apply bg-gray-200 text-left
}
th, th,
td td {
@apply px-4 py-2 border border-solid border-gray-300 @apply px-4 py-2 border border-solid border-gray-300
}
}
table.is-striped table.is-striped {
tbody > tr:not(:nth-child(odd)) td tbody > tr:not(:nth-child(odd)) td {
@apply bg-gray-100 @apply bg-gray-100
}
}

View file

@ -1,7 +1,9 @@
.video-full .video-full {
@apply w-full relative @apply w-full relative;
padding-top: 56.25% padding-top: 56.25%;
iframe, iframe,
embed embed {
@apply absolute h-full left-0 top-0 w-full @apply absolute h-full left-0 top-0 w-full
}
}

View file

@ -1,2 +1,3 @@
.widget .widget {
@apply block mb-6 @apply block mb-6
}

View file

@ -1,5 +1,7 @@
.wrap .wrap {
@apply w-full max-w-3xl mx-auto @apply w-full max-w-3xl mx-auto;
&.is-wide &.is-wide {
@apply max-w-5xl @apply max-w-5xl
}
}

View file

@ -1,18 +1,18 @@
@import 'tailwindcss/base' @import 'tailwindcss/base';
@import './base.css' @import './base.css';
@import 'tailwindcss/components' @import 'tailwindcss/components';
@import './components/button.css' @import './components/button.css';
@import './components/container.css' @import './components/container.css';
@import './components/lead.css' @import './components/lead.css';
@import './components/markup.css' @import './components/markup.css';
@import './components/note.css' @import './components/note.css';
@import './components/table.css' @import './components/table.css';
@import './components/video.css' @import './components/video.css';
@import './components/widget.css' @import './components/widget.css';
@import './components/wrap.css' @import './components/wrap.css';
@import 'highlightjs/styles/github-gist' @import 'highlightjs/styles/github-gist';
@import 'tailwindcss/utilities' @import 'tailwindcss/utilities';
@import './utilities.css' @import './utilities.css';

View file

@ -1,2 +1,3 @@
.no-js .js-hidden .no-js .js-hidden {
display: none display: none
}

4
mix-manifest.json Normal file
View file

@ -0,0 +1,4 @@
{
"/source/build/app.js": "/source/build/app.js",
"/source/build/app.css": "/source/build/app.css"
}

View file

@ -1,9 +1,10 @@
[build] [build]
command = """ command = """
composer test && \ composer test && \
yarn lint --fix-dry-run && \ composer build && \
yarn build && \ npm run lint --fix-dry-run && \
composer build npm run production && \
cp -R source/build output_prod
""" """
publish = "output_prod" publish = "output_prod"
environment = { PHP_VERSION = "7.2", YARN_VERSION = "1.13.0" } environment = { PHP_VERSION = "7.2", YARN_VERSION = "1.13.0" }

10925
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,14 +1,18 @@
{ {
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "encore dev", "dev": "npm run development",
"watch": "encore dev --watch", "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"build": "encore production --progress", "lint": "eslint --ext .js,.vue assets/js/app.js",
"lint": "eslint --ext .js,.vue assets/js/app.js" "watch": "npm run development -- --watch",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
}, },
"dependencies": { "dependencies": {
"@symfony/webpack-encore": "^0.28.0", "cross-env": "^6.0.3",
"highlightjs": "^9.16.2", "highlightjs": "^9.16.2",
"laravel-mix": "^5.0.0",
"laravel-mix-purgecss": "^4.2.0",
"postcss-import": "^12.0.1", "postcss-import": "^12.0.1",
"postcss-nested": "^4.2.1", "postcss-nested": "^4.2.1",
"tailwindcss": "^1.1.3", "tailwindcss": "^1.1.3",
@ -20,6 +24,8 @@
"vue": "^2.6.10" "vue": "^2.6.10"
}, },
"devDependencies": { "devDependencies": {
"browser-sync": "^2.26.7",
"browser-sync-webpack-plugin": "^2.0.1",
"eslint": "^5.15.3", "eslint": "^5.15.3",
"eslint-config-standard": "^12.0.0", "eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0", "eslint-plugin-import": "^2.16.0",

View file

@ -1,9 +0,0 @@
module.exports = {
parser: 'sugarss',
plugins: [
require('postcss-import'),
require('tailwindcss'),
require('postcss-nested'),
require('autoprefixer')
]
}

View file

@ -9,7 +9,7 @@
<meta name="twitter:creator" content="@{{ site.twitter.user }}"> <meta name="twitter:creator" content="@{{ site.twitter.user }}">
{% endblock %} {% endblock %}
<link rel="stylesheet" href="{{ asset('build/app.css') }}"> <link rel="stylesheet" href="/build/app.css">
{% block stylesheets %}{% endblock %} {% block stylesheets %}{% endblock %}
{% for size in site.apple_touch_icon_sizes %} {% for size in site.apple_touch_icon_sizes %}
@ -29,7 +29,7 @@
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '{{ site.google_analytics.id }}', 'auto'); ga('send', 'pageview');</script> <script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '{{ site.google_analytics.id }}', 'auto'); ga('send', 'pageview');</script>
{% endif %} {% endif %}
<script src="{{ asset('build/app.js') }}"></script> <script src="/build/app.js"></script>
{% block scripts %}{% endblock %} {% block scripts %}{% endblock %}
</body> </body>
</html> </html>

View file

@ -1,27 +0,0 @@
const Encore = require('@symfony/webpack-encore')
const glob = require('glob-all')
const PurgecssPlugin = require('purgecss-webpack-plugin')
Encore
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.setOutputPath('source/build/')
.setPublicPath('/build')
.addEntry('app', './assets/js/app.js')
.enablePostCssLoader()
.enableVueLoader()
.enableSourceMaps(!Encore.isProduction())
if (Encore.isProduction()) {
Encore
.enableVersioning()
.addPlugin(new PurgecssPlugin({
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
paths: () => glob.sync([
'assets/**/*.vue',
'source/**/*.{md,twig}'
])
}))
}
module.exports = Encore.getWebpackConfig()

27
webpack.mix.js Normal file
View file

@ -0,0 +1,27 @@
let mix = require('laravel-mix')
require('laravel-mix-purgecss')
mix.disableNotifications()
.postCss('assets/css/tailwind.css', 'source/build/app.css', [
require('postcss-import'),
require('tailwindcss'),
require('postcss-nested'),
require('autoprefixer')
])
.js('assets/js/app.js', 'source/build')
mix.browserSync({
proxy: 'localhost:8000',
files: [
'output_*/**/*'
],
notify: false
})
mix.purgeCss({
extensions: ['html', 'twig', 'vue'],
folders: ['assets/js', 'output_*'],
whitelistPatterns: [],
whitelistPatternsChildren: []
})

7163
yarn.lock

File diff suppressed because it is too large Load diff