Skip to content

Commit

Permalink
fix(extract): normalize paths from rendered stats
Browse files Browse the repository at this point in the history
  • Loading branch information
jgranstrom committed Mar 31, 2017
1 parent d880120 commit 65566ba
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/extract.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
import Promise from 'bluebird';
import sass from 'node-sass';
import path from 'path';
import { loadCompiledFiles, loadCompiledFilesSync } from './load';
import { processFiles } from './process';
import { makeImporter, makeSyncImporter } from './importer';

Promise.promisifyAll(sass);

const NORMALIZED_PATH_SEPARATOR = '/';
const PLATFORM_PATH_SEPARATOR = path.sep;

/**
* Normalize path across platforms
*/
function normalizePath(path) {
return path.split(PLATFORM_PATH_SEPARATOR).join(NORMALIZED_PATH_SEPARATOR);
}

/**
* Get rendered stats required for extraction
*/
function getRenderedStats(rendered) {
return {
entryFilename: rendered.stats.entry,
includedFiles: rendered.stats.includedFiles,
entryFilename: normalizePath(rendered.stats.entry),
includedFiles: rendered.stats.includedFiles.map(normalizePath),
};
}

Expand Down

0 comments on commit 65566ba

Please sign in to comment.