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

Tailwind CSSを導入しました #2

Merged
merged 2 commits into from May 22, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -1,3 +1,9 @@
class TailwindExtractor {
static extract(content) {
return content.match(/[A-Za-z0-9-_:\/]+/g) || [];
}
}

module.exports = {
siteName: 'Gridsomeで作るブログ',
plugins: [
@@ -25,4 +31,38 @@ module.exports = {
anchorClassName: 'icon icon-link',
}
},

chainWebpack: config => {
config.module
.rule('css')
.oneOf('normal')
.use('postcss-loader')
.tap(options => {
options.plugins.unshift(...[
require('postcss-import'),
require('postcss-nested'),
require('tailwindcss'),
])

if (process.env.NODE_ENV === 'production') {
options.plugins.push(...[
require('@fullhuman/postcss-purgecss')({
content: [
'src/assets/**/*.css',
'src/**/*.vue',
'src/**/*.js'
],
extractors: [
{
extractor: TailwindExtractor,
extensions: ['css', 'vue', 'js']
}
],
}),
])
}

return options
})
},
}
@@ -10,5 +10,11 @@
"@gridsome/source-filesystem": "0.5.0",
"@gridsome/transformer-remark": "0.3.2",
"gridsome": "^0.6.0"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "1.2.0",
"postcss-import": "12.0.1",
"postcss-nested": "4.1.2",
"tailwindcss": "1.0.1"
}
}
@@ -0,0 +1,7 @@
/*! purgecss start ignore */
@import 'tailwindcss/base';
/*! purgecss end ignore */

@import 'tailwindcss/components';

@import 'tailwindcss/utilities';
@@ -1,6 +1,7 @@
// This is the main.js file. Import global CSS and scripts here.
// The Client API can be used here. Learn more: gridsome.org/docs/client-api

import '~/assets/style/main.css'
import DefaultLayout from '~/layouts/Default.vue'

export default function (Vue, { router, head, isClient }) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.