diff --git a/CHANGELOG.md b/CHANGELOG.md index f8b3cd6..6f11fb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [unreleased] +- [#2251](https://github.com/teambit/bit/issues/2251) support css url functions without explicitly import + ## [2.1.5] - 2020-01-12 ### Bug fixes diff --git a/src/dependency-builder/detectives/detective-css-and-preprocessors/index.ts b/src/dependency-builder/detectives/detective-css-and-preprocessors/index.ts index 9b163c0..860ee46 100644 --- a/src/dependency-builder/detectives/detective-css-and-preprocessors/index.ts +++ b/src/dependency-builder/detectives/detective-css-and-preprocessors/index.ts @@ -45,13 +45,17 @@ module.exports = function detective(fileContent, syntax) { }; function isImportStatement(node) { - if (node.type === 'Atrule' && node.name === 'import') { + if ((node.type === 'Atrule' && node.name === 'import') || node.type === 'Url') { return true; } return false; } function extractDependencies(importStatementNode) { + // handle URL functions without import, like `background-image: url('../button.png');` + if (importStatementNode.type === 'Url') { + return importStatementNode.value.value.replace(/["']/g, ''); + } // handle URL import @import url("baz.css"); if ( importStatementNode.prelude.type === 'AtrulePrelude' &&