Skip to content

Commit

Permalink
Small package loading improvements (#4278)
Browse files Browse the repository at this point in the history
  • Loading branch information
vankop authored and hudochenkov committed Sep 13, 2019
1 parent bd51e6e commit 2c5bcb6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/formatters/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/* @flow */
"use strict";

const importLazy = require("import-lazy")(require);

module.exports = {
compact: require("./compactFormatter"),
json: require("./jsonFormatter"),
string: require("./stringFormatter"),
string: importLazy("./stringFormatter"),
unix: require("./unixFormatter"),
verbose: require("./verboseFormatter")
verbose: importLazy("./verboseFormatter")
};
6 changes: 5 additions & 1 deletion lib/getPostcssResult.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* @flow */
"use strict";

const autoSyntax = require("postcss-syntax");
const dynamicRequire = require("./dynamicRequire");
const fs = require("fs");
const LazyResult = require("postcss/lib/lazy-result");
const postcss = require("postcss");
let autoSyntax = null;

const postcssProcessor = postcss();

Expand Down Expand Up @@ -88,6 +88,10 @@ module.exports = function(
!(options.codeProcessors && options.codeProcessors.length) ||
(options.filePath && /\.(scss|sass|less)$/.test(options.filePath))
) {
if (!autoSyntax) {
autoSyntax = require("postcss-syntax");
}

syntax = autoSyntax({
css: {
parse: stylelint._options.fix
Expand Down

0 comments on commit 2c5bcb6

Please sign in to comment.