Merge pull request #678 from tailwindcss/pass-postcss-to-plugins

Pass postcss to plugins directly
This commit is contained in:
Adam Wathan 2019-02-22 10:05:01 -05:00 committed by GitHub
commit bf475d5b7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -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({

View File

@ -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 => {