Skip to content

Commit

Permalink
More config load changes
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett committed Jan 15, 2018
1 parent 3e1c0fc commit ee654c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions packages/core/parcel-bundler/src/transforms/postcss.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const localRequire = require('../utils/localRequire');
const loadPlugins = require('../utils/loadPlugins');
const postcss = require('postcss');
const Config = require('../utils/config');
const cssnano = require('cssnano');

module.exports = async function(asset) {
Expand All @@ -20,7 +19,7 @@ module.exports = async function(asset) {
async function getConfig(asset) {
let config =
asset.package.postcss ||
(await Config.load(asset.name, [
(await asset.getConfig([
'.postcssrc',
'.postcssrc.js',
'postcss.config.js'
Expand Down Expand Up @@ -52,7 +51,7 @@ async function getConfig(asset) {

if (asset.options.minify) {
config.plugins.push(
cssnano((await Config.load(asset.name, ['cssnano.config.js'])) || {})
cssnano((await asset.getConfig(['cssnano.config.js'])) || {})
);
}

Expand Down
5 changes: 2 additions & 3 deletions packages/core/parcel-bundler/src/transforms/posthtml.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const loadPlugins = require('../utils/loadPlugins');
const posthtml = require('posthtml');
const Config = require('../utils/config');
const htmlnano = require('htmlnano');

module.exports = async function(asset) {
Expand All @@ -19,7 +18,7 @@ module.exports = async function(asset) {
async function getConfig(asset) {
let config =
asset.package.posthtml ||
(await Config.load(asset.name, [
(await asset.getConfig([
'.posthtmlrc',
'.posthtmlrc.js',
'posthtml.config.js'
Expand All @@ -33,7 +32,7 @@ async function getConfig(asset) {

if (asset.options.minify) {
const htmlNanoConfig = asset.package.htmlnano ||
(await Config.load(asset.name, ['.htmlnanorc', '.htmlnanorc.js'])) || {
(await asset.getConfig(['.htmlnanorc', '.htmlnanorc.js'])) || {
collapseWhitespace: 'conservative'
};

Expand Down

0 comments on commit ee654c0

Please sign in to comment.