From a499c4abc3514633d06215501037d5dc563294dc Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Fri, 6 May 2016 13:02:21 -0400 Subject: [PATCH] Allow .styl files in imports/ directories to be imported. Analogous to cd8bc10b1d7be519d43ec92c612e738ca091a311, which implemented the same change in logic for .less files. --- packages/stylus/package.js | 2 +- packages/stylus/plugin/compile-stylus.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/stylus/package.js b/packages/stylus/package.js index 85f8310d3e..6659b74f99 100644 --- a/packages/stylus/package.js +++ b/packages/stylus/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: 'Expressive, dynamic, robust CSS', - version: "2.511.5" + version: "2.512.0" }); Package.registerBuildPlugin({ diff --git a/packages/stylus/plugin/compile-stylus.js b/packages/stylus/plugin/compile-stylus.js index 8a27b33dea..05715759c6 100644 --- a/packages/stylus/plugin/compile-stylus.js +++ b/packages/stylus/plugin/compile-stylus.js @@ -27,10 +27,10 @@ class StylusCompiler extends MultiFileCachingCompiler { this.sourceMapSize(compileResult.sourceMap); } - // The heuristic is that a file is an import (ie, is not itself processed as a - // root) if it is in a subdirectory named 'imports' or if it matches - // *.import.styl. This can be overridden in either direction via an explicit - // `isImport` file option in api.addFiles. + // The heuristic is that a file is an import (ie, is not itself + // processed as a root) if it matches *.import.styl. This can be + // overridden in either direction via an explicit `isImport` file option + // in api.addFiles. isRoot(inputFile) { const fileOptions = inputFile.getFileOptions(); if (fileOptions.hasOwnProperty('isImport')) { @@ -38,8 +38,7 @@ class StylusCompiler extends MultiFileCachingCompiler { } const pathInPackage = inputFile.getPathInPackage(); - return !(/\.import\.styl$/.test(pathInPackage) || - /(?:^|\/)imports\//.test(pathInPackage)); + return ! /\.import\.styl$/.test(pathInPackage); } compileOneFile(inputFile, allFiles) {