How to use the fast-sass-loader/lib/utils.findComments function in fast-sass-loader

To help you get started, we’ve selected a few fast-sass-loader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github camptocamp / ngeo / buildtools / webpack.plugin.js View on Github external
if (relativeFile[0] !== '.') {
          relativeFile = `./${relativeFile}`;
        }

        return `url(${left}${relativeFile}${right})`;
      } else {
        return total;
      }
    } else {
      return total;
    }
  });

  // find comments should after content.replace(...), otherwise the comments offset will be incorrect
  const commentRanges = utils.findComments(content);

  // replace @import "..."
  function * importReplacer(total) {
    // if current import is in comments, then skip it
    const range = this;
    const finded = commentRanges.find((commentRange) => {
      if (range.start >= commentRange[0] && range.end <= commentRange[1]) {
        return true;
      }
    });

    if (finded) {
      return total;
    }

    const contents = [];

fast-sass-loader

fast sass loader for Webpack

MIT
Latest version published 3 years ago

Package Health Score

44 / 100
Full package analysis

Popular fast-sass-loader functions