This repository has been archived by the owner on Mar 18, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from roots/tailwind-preset
Add Tailwind CSS preset
- Loading branch information
Showing
14 changed files
with
1,292 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Roots\Sage\Installer\Presets; | ||
|
||
class Tailwind extends Preset | ||
{ | ||
/** {@inheritdoc} */ | ||
protected function updatePackagesArray(array $packages) | ||
{ | ||
$packages['devDependencies']['tailwindcss'] = '^0.6.4'; | ||
|
||
/** Add Tailwind specific at-rules */ | ||
$ignoreAtRules =& $packages['stylelint']['rules']['at-rule-no-unknown'][1]['ignoreAtRules']; | ||
$tailwindAtRules = ['tailwind', 'apply', 'responsive', 'variants', 'screen']; | ||
|
||
foreach ($tailwindAtRules as $rule) { | ||
if (!in_array($rule, $ignoreAtRules)) { | ||
$ignoreAtRules[] = $rule; | ||
} | ||
} | ||
|
||
return $packages; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
'use strict'; // eslint-disable-line | ||
|
||
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
|
||
const config = require('./config'); | ||
|
||
/** Default PostCSS plugins */ | ||
let postcssPlugins = [ | ||
require('tailwindcss')(`${config.paths.assets}/styles/tailwind.config.js`), | ||
require('autoprefixer')(), | ||
]; | ||
|
||
/** Add cssnano when optimizing */ | ||
config.enabled.optimize | ||
? postcssPlugins.push( | ||
require('cssnano')({ | ||
preset: ['default', { discardComments: { removeAll: true } }], | ||
}), | ||
) | ||
: false; | ||
|
||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.scss$/, | ||
include: config.paths.assets, | ||
use: ExtractTextPlugin.extract({ | ||
fallback: 'style', | ||
use: [ | ||
{ loader: 'cache' }, | ||
{ loader: 'css', options: { sourceMap: false } }, | ||
{ | ||
loader: 'postcss', | ||
options: { | ||
parser: config.enabled.optimize | ||
? 'postcss-safe-parser' | ||
: undefined, | ||
plugins: postcssPlugins, | ||
sourceMap: false, | ||
}, | ||
}, | ||
{ | ||
loader: 'resolve-url', | ||
options: { silent: true, sourceMap: false }, | ||
}, | ||
{ | ||
loader: 'sass', | ||
options: { sourceComments: true, sourceMap: false }, | ||
}, | ||
], | ||
}), | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
h5, | ||
h6 { | ||
@apply mb-2 leading-tight; | ||
} | ||
|
||
p { | ||
@apply mb-3 leading-normal; | ||
} | ||
|
||
a { | ||
@apply text-primary no-underline border-b border-transparent; | ||
|
||
transition: 0.2s ease; | ||
|
||
&:hover { | ||
@apply border-primary; | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.btn { | ||
@apply bg-primary rounded my-3 px-4 py-3 text-white leading-none; | ||
|
||
transition: 0.2s ease; | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Presets/stubs/Tailwind/styles/components/_comments.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.comment-list { | ||
@apply list-reset; | ||
} | ||
|
||
.comment-list ol { | ||
list-style: none; | ||
} | ||
|
||
.comment-form p { | ||
@apply mb-4; | ||
} | ||
|
||
.comment-form input[type="text"], | ||
.comment-form input[type="email"], | ||
.comment-form input[type="url"], | ||
.comment-form textarea { | ||
@apply block appearance-none w-full py-1 px-2 mb-1 text-base leading-normal bg-white text-grey-darker border border-grey rounded; | ||
|
||
&:focus { | ||
@apply shadow-outline; | ||
} | ||
} | ||
|
||
.comment-form input[type="submit"] { | ||
@apply btn bg-grey-dark; | ||
|
||
&:hover { | ||
@apply bg-grey-darker; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** Search form */ | ||
.search-form { | ||
@apply flex items-center; | ||
} | ||
|
||
.search-form label { | ||
@apply mb-4; | ||
|
||
font-weight: normal; | ||
} | ||
|
||
.search-form .search-field { | ||
@apply block appearance-none w-full py-1 px-2 mb-1 text-base leading-normal bg-white text-grey-darker border border-grey rounded; | ||
} | ||
|
||
.search-form .search-submit { | ||
@apply inline-block align-middle text-center select-none border font-normal whitespace-no-wrap py-2 px-4 rounded text-base leading-normal no-underline text-grey-lightest bg-grey; | ||
|
||
&:hover { | ||
@apply bg-grey-light; | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
src/Presets/stubs/Tailwind/styles/components/_wp-classes.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/** | ||
* WordPress Generated Classes | ||
* @see http://codex.wordpress.org/CSS#WordPress_Generated_Classes | ||
*/ | ||
|
||
/** Media alignment */ | ||
.alignnone { | ||
margin-left: 0; | ||
margin-right: 0; | ||
max-width: 100%; | ||
height: auto; | ||
} | ||
|
||
.aligncenter { | ||
@apply my-2 mx-auto; | ||
|
||
display: block; | ||
height: auto; | ||
} | ||
|
||
.alignleft, | ||
.alignright { | ||
@apply mb-4; | ||
|
||
height: auto; | ||
} | ||
|
||
@screen sm { | ||
.alignleft { | ||
@apply mr-4; | ||
|
||
float: left; | ||
} | ||
|
||
.alignright { | ||
@apply ml-4; | ||
|
||
float: right; | ||
} | ||
} | ||
|
||
/** Captions */ | ||
.wp-caption { | ||
@apply inline-block mb-4; | ||
} | ||
|
||
.wp-caption img { | ||
@apply mb-2 leading-none max-w-full h-auto; | ||
} | ||
|
||
.wp-caption-text { | ||
font-size: 90%; | ||
color: #6c757d; | ||
} | ||
|
||
/** Text meant only for screen readers */ | ||
.sr-only, | ||
.screen-reader-text { | ||
position: absolute; | ||
width: 1px; | ||
height: 1px; | ||
padding: 0; | ||
overflow: hidden; | ||
clip: rect(0, 0, 0, 0); | ||
white-space: nowrap; | ||
border: 0; | ||
} | ||
|
||
.sr-only-focusable:active, | ||
.screen-reader-text:active, | ||
.sr-only-focusable:focus, | ||
.screen-reader-text:focus { | ||
position: static; | ||
width: auto; | ||
height: auto; | ||
overflow: visible; | ||
clip: auto; | ||
white-space: normal; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.banner .nav { | ||
@apply list-reset flex flex-wrap; | ||
} | ||
|
||
.banner .nav a { | ||
@apply inline-block px-4 py-2 border-none; | ||
|
||
&:hover { | ||
color: darken(#525ddc, 30%); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* This injects Tailwind's base styles, which is a combination of | ||
* Normalize.css and some additional base styles. | ||
* | ||
* You can see the styles here: | ||
* https://github.com/tailwindcss/tailwindcss/blob/master/css/preflight.css | ||
* | ||
* If using `postcss-import`, use this import instead: | ||
* | ||
* @import "tailwindcss/preflight"; | ||
*/ | ||
@tailwind preflight; | ||
|
||
/** Import variables */ | ||
@import "common/variables"; | ||
|
||
/** Import everything from autoload */ | ||
@import "./autoload/**/*"; | ||
|
||
/** | ||
* Import npm dependencies | ||
* | ||
* Prefix your imports with `~` to grab from node_modules/ | ||
* @see https://github.com/webpack-contrib/sass-loader#imports | ||
*/ | ||
// @import "~some-node-module"; | ||
|
||
/** | ||
* This injects any component classes registered by Tailwind plugins. | ||
* | ||
* If using `postcss-import`, use this import instead: | ||
* | ||
* @import "tailwindcss/components"; | ||
*/ | ||
@tailwind components; | ||
|
||
/** Import theme styles */ | ||
@import "common/global"; | ||
@import "components/buttons"; | ||
@import "components/comments"; | ||
@import "components/forms"; | ||
@import "components/wp-classes"; | ||
@import "layouts/header"; | ||
@import "layouts/sidebar"; | ||
@import "layouts/footer"; | ||
@import "layouts/pages"; | ||
@import "layouts/posts"; | ||
@import "layouts/tinymce"; | ||
|
||
/** | ||
* This injects all of Tailwind's utility classes, generated based on your | ||
* config file. | ||
* | ||
* If using `postcss-import`, use this import instead: | ||
* | ||
* @import "tailwindcss/utilities"; | ||
*/ | ||
@tailwind utilities; | ||
|
||
/** | ||
* Here you would add any custom utilities you need that don't come out of the | ||
* box with Tailwind. | ||
* | ||
* Example : | ||
* | ||
* .bg-pattern-graph-paper { ... } | ||
* .skew-45 { ... } | ||
* | ||
* Or if using a preprocessor or `postcss-import`: | ||
* | ||
* @import "utilities/background-patterns"; | ||
* @import "utilities/skew-transforms"; | ||
*/ |
Oops, something went wrong.