Skip to content

Commit

Permalink
Merge pull request #7353 from RocketChat/require-css-plugins
Browse files Browse the repository at this point in the history
[FIX] Use regular require() for postcss plugins
  • Loading branch information
sampaiodiego committed Jun 29, 2017
2 parents cc782cc + 9afe9d1 commit 8912879
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
1 change: 0 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"keywords": ["meteor", "social", "community", "chat"],
"website": "https://rocket.chat",
"env": {
"NODE_ENV": "production",
"BUILDPACK_URL": "https://github.com/RocketChat/meteor-buildpack-horse.git",
"HEROKU_APP_NAME": {
"description": "Please re-enter your App Name from the top.",
Expand Down
13 changes: 2 additions & 11 deletions packages/rocketchat-postcss/plugin/minify-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const getPostCSSPlugins = () => {
const plugins = [];
if (postCSSConfig.plugins) {
Object.keys(postCSSConfig.plugins).forEach((pluginName) => {
const postCSSPlugin = Npm.require(pluginName);
const postCSSPlugin = require(pluginName);
if (postCSSPlugin && postCSSPlugin.name === 'creator' && postCSSPlugin().postcssPlugin) {
plugins.push(postCSSPlugin(postCSSConfig.plugins ? postCSSConfig.plugins[pluginName] : {}));
}
Expand All @@ -27,14 +27,6 @@ const getPostCSSPlugins = () => {
return plugins;
};

const getPostCSSParser = () => {
if (postCSSConfig.parser) {
return Npm.require(postCSSConfig.parser);
}

return false;
};

const getExcludedPackages = () => {
if (postCSSConfig.excludedPackages && postCSSConfig.excludedPackages instanceof Array) {
return postCSSConfig.excludedPackages;
Expand Down Expand Up @@ -72,8 +64,7 @@ const mergeCss = css => {

postCSS(isFileForPostCSS ? getPostCSSPlugins() : [])
.process(file.getContentsAsString(), {
from: process.cwd() + file._source.url.replace('_', '-'),
parser: getPostCSSParser()
from: process.cwd() + file._source.url.replace('_', '-')
})
.then(result => {
result.warnings().forEach(warn => {
Expand Down

0 comments on commit 8912879

Please sign in to comment.