Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Update to Tailwind 0.7.2 and add possibility to handle multiple pages #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ npm run dev

Webpack Development Server will watch `/src/styles.css` and `/tailwind.js` and rebuild your stylesheet on every change.

You can play around with `/index.html` to see the effects of your changes.
You can play around with `src/template/index.html` to see the effects of your changes.

You can also add more pages in `src/template/`. In order for webpack to pick up new pages, you have to restart the webpack development server.

To build a production bundle run:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"postcss": "^6.0.19",
"postcss-loader": "^2.1.1",
"style-loader": "^0.20.3",
"tailwindcss": ">=0.6.5",
"tailwindcss": ">=0.7.0",
"webpack": "^4.1.1",
"webpack-cli": "^2.0.12",
"webpack-dev-server": "^3.1.1"
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions src/pages/otherpage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<title>Tailwind Starter Template</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div class="min-h-screen flex items-center justify-center">
<h1 class="text-5xl text-purple font-sans">Greetings from Other Page</h1>
</div>
</body>
</html>
52 changes: 41 additions & 11 deletions tailwind.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ View the full documentation at https://tailwindcss.com.
|
*/

// let defaultConfig = require('tailwindcss/defaultConfig')()
let defaultConfig = require('tailwindcss/defaultConfig')()


/*
Expand Down Expand Up @@ -226,7 +226,7 @@ module.exports = {
'Liberation Mono',
'Courier New',
'monospace',
]
],
},


Expand Down Expand Up @@ -474,6 +474,7 @@ module.exports = {
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'5': '1.25rem',
'6': '1.5rem',
'8': '2rem',
'10': '2.5rem',
Expand All @@ -495,7 +496,7 @@ module.exports = {
'1/6': '16.66667%',
'5/6': '83.33333%',
'full': '100%',
'screen': '100vw'
'screen': '100vw',
},


Expand All @@ -521,6 +522,7 @@ module.exports = {
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'5': '1.25rem',
'6': '1.5rem',
'8': '2rem',
'10': '2.5rem',
Expand All @@ -531,7 +533,7 @@ module.exports = {
'48': '12rem',
'64': '16rem',
'full': '100%',
'screen': '100vh'
'screen': '100vh',
},


Expand Down Expand Up @@ -572,7 +574,7 @@ module.exports = {
minHeight: {
'0': '0',
'full': '100%',
'screen': '100vh'
'screen': '100vh',
},


Expand Down Expand Up @@ -647,8 +649,15 @@ module.exports = {
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'5': '1.25rem',
'6': '1.5rem',
'8': '2rem',
'10': '2.5rem',
'12': '3rem',
'16': '4rem',
'20': '5rem',
'24': '6rem',
'32': '8rem',
},


Expand All @@ -675,8 +684,15 @@ module.exports = {
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'5': '1.25rem',
'6': '1.5rem',
'8': '2rem',
'10': '2.5rem',
'12': '3rem',
'16': '4rem',
'20': '5rem',
'24': '6rem',
'32': '8rem',
},


Expand All @@ -702,8 +718,15 @@ module.exports = {
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'5': '1.25rem',
'6': '1.5rem',
'8': '2rem',
'10': '2.5rem',
'12': '3rem',
'16': '4rem',
'20': '5rem',
'24': '6rem',
'32': '8rem',
},


Expand All @@ -728,6 +751,7 @@ module.exports = {
'md': '0 4px 8px 0 rgba(0,0,0,0.12), 0 2px 4px 0 rgba(0,0,0,0.08)',
'lg': '0 15px 30px 0 rgba(0,0,0,0.11), 0 5px 15px 0 rgba(0,0,0,0.08)',
'inner': 'inset 0 2px 4px 0 rgba(0,0,0,0.06)',
'outline': '0 0 0 3px rgba(52,144,220,0.5)',
'none': 'none',
},

Expand Down Expand Up @@ -828,6 +852,7 @@ module.exports = {
| - responsive
| - hover
| - focus
| - focus-within
| - active
| - group-hover
|
Expand All @@ -838,11 +863,12 @@ module.exports = {
modules: {
appearance: ['responsive'],
backgroundAttachment: ['responsive'],
backgroundColors: ['responsive', 'hover'],
backgroundColors: ['responsive', 'hover', 'focus'],
backgroundPosition: ['responsive'],
backgroundRepeat: ['responsive'],
backgroundSize: ['responsive'],
borderColors: ['responsive', 'hover'],
borderCollapse: [],
borderColors: ['responsive', 'hover', 'focus'],
borderRadius: ['responsive'],
borderStyle: ['responsive'],
borderWidths: ['responsive'],
Expand All @@ -851,7 +877,7 @@ module.exports = {
flexbox: ['responsive'],
float: ['responsive'],
fonts: ['responsive'],
fontWeights: ['responsive', 'hover'],
fontWeights: ['responsive', 'hover', 'focus'],
height: ['responsive'],
leading: ['responsive'],
lists: ['responsive'],
Expand All @@ -861,19 +887,23 @@ module.exports = {
minHeight: ['responsive'],
minWidth: ['responsive'],
negativeMargin: ['responsive'],
objectFit: false,
objectPosition: false,
opacity: ['responsive'],
outline: ['focus'],
overflow: ['responsive'],
padding: ['responsive'],
pointerEvents: ['responsive'],
position: ['responsive'],
resize: ['responsive'],
shadows: ['responsive'],
shadows: ['responsive', 'hover', 'focus'],
svgFill: [],
svgStroke: [],
tableLayout: ['responsive'],
textAlign: ['responsive'],
textColors: ['responsive', 'hover'],
textColors: ['responsive', 'hover', 'focus'],
textSizes: ['responsive'],
textStyle: ['responsive', 'hover'],
textStyle: ['responsive', 'hover', 'focus'],
tracking: ['responsive'],
userSelect: ['responsive'],
verticalAlign: ['responsive'],
Expand Down
28 changes: 22 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
const path = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const fs = require('fs')

// Our function that generates our html plugins
function generateHtmlPlugins (templateDir) {
// Read files in template directory
const templateFiles = fs.readdirSync(path.resolve(__dirname, templateDir))
return templateFiles.map(item => {
// Split names and extension
const parts = item.split('.')
const name = parts[0]
const extension = parts[1]
// Create new HTMLWebpackPlugin with options
return new HtmlWebpackPlugin({
filename: `${name}.html`,
template: path.resolve(__dirname, `${templateDir}/${name}.${extension}`)
})
})
}

const htmlPlugins = generateHtmlPlugins('./src/pages')

module.exports = {
entry: './src/styles.css',
Expand All @@ -22,10 +42,6 @@ module.exports = {
plugins: [
new ExtractTextPlugin('styles.css', {
disable: process.env.NODE_ENV === 'development',
}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/index.html',
}),
],
})
].concat(htmlPlugins)
}
Loading