Skip to content

Commit bf475d5

Browse files
authored
Merge pull request #678 from tailwindcss/pass-postcss-to-plugins
Pass postcss to plugins directly
2 parents 48b7230 + 10aa365 commit bf475d5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

__tests__/processPlugins.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import _ from 'lodash'
2-
import postcss from 'postcss'
2+
import _postcss from 'postcss'
33
import processPlugins from '../src/util/processPlugins'
44

55
function css(nodes) {
6-
return postcss.root({ nodes }).toString()
6+
return _postcss.root({ nodes }).toString()
77
}
88

99
function makeConfig(overrides) {
@@ -97,7 +97,7 @@ test('plugins can create utilities with arrays of objects', () => {
9797
test('plugins can create utilities with raw PostCSS nodes', () => {
9898
const { components, utilities } = processPlugins(
9999
[
100-
function({ addUtilities }) {
100+
function({ addUtilities, postcss }) {
101101
addUtilities([
102102
postcss.rule({ selector: '.object-fill' }).append([
103103
postcss.decl({
@@ -142,7 +142,7 @@ test('plugins can create utilities with raw PostCSS nodes', () => {
142142
test('plugins can create utilities with mixed object styles and PostCSS nodes', () => {
143143
const { components, utilities } = processPlugins(
144144
[
145-
function({ addUtilities }) {
145+
function({ addUtilities, postcss }) {
146146
addUtilities([
147147
{
148148
'.object-fill': {
@@ -259,7 +259,7 @@ test('plugins can create components with object syntax', () => {
259259
test('plugins can create components with raw PostCSS nodes', () => {
260260
const { components, utilities } = processPlugins(
261261
[
262-
function({ addComponents }) {
262+
function({ addComponents, postcss }) {
263263
addComponents([
264264
postcss.rule({ selector: '.btn-blue' }).append([
265265
postcss.decl({
@@ -308,7 +308,7 @@ test('plugins can create components with raw PostCSS nodes', () => {
308308
test('plugins can create components with mixed object styles and raw PostCSS nodes', () => {
309309
const { components, utilities } = processPlugins(
310310
[
311-
function({ addComponents }) {
311+
function({ addComponents, postcss }) {
312312
addComponents([
313313
postcss.rule({ selector: '.btn-blue' }).append([
314314
postcss.decl({

src/util/processPlugins.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default function(plugins, config) {
2222

2323
plugins.forEach(plugin => {
2424
plugin({
25+
postcss,
2526
config: (path, defaultValue) => _.get(config, path, defaultValue),
2627
e: escapeClassName,
2728
prefix: selector => {

0 commit comments

Comments
 (0)