mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Merge pull request #678 from tailwindcss/pass-postcss-to-plugins
Pass postcss to plugins directly
This commit is contained in:
commit
bf475d5b7f
@ -1,9 +1,9 @@
|
||||
import _ from 'lodash'
|
||||
import postcss from 'postcss'
|
||||
import _postcss from 'postcss'
|
||||
import processPlugins from '../src/util/processPlugins'
|
||||
|
||||
function css(nodes) {
|
||||
return postcss.root({ nodes }).toString()
|
||||
return _postcss.root({ nodes }).toString()
|
||||
}
|
||||
|
||||
function makeConfig(overrides) {
|
||||
@ -97,7 +97,7 @@ test('plugins can create utilities with arrays of objects', () => {
|
||||
test('plugins can create utilities with raw PostCSS nodes', () => {
|
||||
const { components, utilities } = processPlugins(
|
||||
[
|
||||
function({ addUtilities }) {
|
||||
function({ addUtilities, postcss }) {
|
||||
addUtilities([
|
||||
postcss.rule({ selector: '.object-fill' }).append([
|
||||
postcss.decl({
|
||||
@ -142,7 +142,7 @@ test('plugins can create utilities with raw PostCSS nodes', () => {
|
||||
test('plugins can create utilities with mixed object styles and PostCSS nodes', () => {
|
||||
const { components, utilities } = processPlugins(
|
||||
[
|
||||
function({ addUtilities }) {
|
||||
function({ addUtilities, postcss }) {
|
||||
addUtilities([
|
||||
{
|
||||
'.object-fill': {
|
||||
@ -259,7 +259,7 @@ test('plugins can create components with object syntax', () => {
|
||||
test('plugins can create components with raw PostCSS nodes', () => {
|
||||
const { components, utilities } = processPlugins(
|
||||
[
|
||||
function({ addComponents }) {
|
||||
function({ addComponents, postcss }) {
|
||||
addComponents([
|
||||
postcss.rule({ selector: '.btn-blue' }).append([
|
||||
postcss.decl({
|
||||
@ -308,7 +308,7 @@ test('plugins can create components with raw PostCSS nodes', () => {
|
||||
test('plugins can create components with mixed object styles and raw PostCSS nodes', () => {
|
||||
const { components, utilities } = processPlugins(
|
||||
[
|
||||
function({ addComponents }) {
|
||||
function({ addComponents, postcss }) {
|
||||
addComponents([
|
||||
postcss.rule({ selector: '.btn-blue' }).append([
|
||||
postcss.decl({
|
||||
|
||||
@ -22,6 +22,7 @@ export default function(plugins, config) {
|
||||
|
||||
plugins.forEach(plugin => {
|
||||
plugin({
|
||||
postcss,
|
||||
config: (path, defaultValue) => _.get(config, path, defaultValue),
|
||||
e: escapeClassName,
|
||||
prefix: selector => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user