Identical filenames in different directories conflict
ururk opened this issue · 1 comments
ururk commented
If I have the following directory structure:
folder1/
- styleFile.scss
folder2/
- styleFile.scss
Both will result in a fileName
of styleFile
Only one file will have its CSS rendered in the browser (this is the rendered JavaScript):
var styles = ".error-msg {}";
var fileName = "styleFile";
var element = document.querySelector("style[data-sass-component='styleFile']");
if (!element) {
var styleBlock = document.createElement("style");
styleBlock.innerHTML = styles;
styleBlock.setAttribute("data-sass-component", fileName);
document.head.appendChild(styleBlock);
} else {
element.innerHTML = styles;
}
The last one to run overwrites any existing style elements.
The library should either:
- Append the extra styles
- Warn the user
- Find another way - perhaps use a "file name" that includes the folder structure:
folder1__styleFile
folder2__styleFile
altgifted commented
now it's working with uuid generation for each file