Closed veged closed 9 years ago
_
is a pretty standard way with Sass to denote that the file is not a whole structure but instead a partial of a larger whole.
What are the tools you are trying to use?
It’s not just a convention but a feature by SASS called partials. Files beginning with an underscore won’t be compiled stand-alone and therefore don’t generate any file in dist
.
I second @Garbee’s question, what BEM tools are you using?
what BEM tools are you using?
@Garbee @surma https://en.bem.info/tools/ and a lot more in npm
actually.
So, we use CSSO and used to use SVGO ourselves, but on the final CSS file. If you are using these tools on the SASS files, it will most likely not work. Got more details? I feel like this is not related to MDL or its usage of underscores.
We were talking about bem-tools and ENB in the first place — tools to build entire BEM projects.
They utilize idea of https://en.bem.info/method/filesystem/ to introspect filesystem and collect bundles of just needed blocks instead of dists with everything.
As you can tell by our folder structure, we didn’t use bem-tools
.
The original question was about the underscores in the filenames, which I hope I answered to your satisfaction. We will probably not adjust MDL for a tool we didn’t use in the first place. I’m closing this issue for now.
@surma but as I can see in gulpfile.js SASS feature for skip underscored partials are not used (if I rename _*.scss
to *.scss
everything works the same)
are there any strong reasons to intentionally break compatibility with wide spread (in BEM ecosystem) file structure? even if you personally don't use bem-tools
or enb
there are people who do — I personally try and stuck in monkey patching file structure after checkout of MDL sources
(I’m not sure where you see _*.scss
in the gulpfile. )
This is not intentionally breaking something, because it never worked in the first place (as we didn’t know about bem-tools
– at least I didn’t). We don’t even adhere to the folder structure. This is somewhat comparable to all the CSS preprocessors (SASS/LESS/Stylus). We chose our tooling to fit our workflow and can’t cater to every personal preference. This is not a great answer, I know.
In any case, changing the folder structure/filenames now is somewhat of a breaking change (some people might be pulling in the SASS code and compiling their own MDL). So your suggested change can only happen for v2 or later.
I’ll assure you that we will keep bem-tools
in mind once we start working on v2. It actually might make our plans for modularization easier.
Out of curiosity: Why are underscores causing problems with bem-tools
? It’s a perfectly valid filename, isn’t it?
@surma Thanks for going considering of using our existing tools for BEM ecosystem for v2
. When you start to code something feel free to ask me or @tadatuta for any help with configurations. Also we have a lot of experience with blocks library development (i.e. bem-components and bem-core). Not just blocks code but also infrastructure such as autotests (JS unit tests, CSS tests with screenshots and HTML templates diff tests), automatically generated library website, documentations with live examples and so on. And we will be happy to share it with you!
Speaking about underscores: it's not fatal problem for current tools to customise naming scheme (maybe a little bit hacky). But existing configs, existing code of blocks and people habits are stuck to scheme described here https://en.bem.info/method/filesystem/.
BTW I'm working on a talk for Odessa.js conference where I gonna show how to use MDL with BEMHTML templates and BEM-aware building tools.
Is there any reason to prefix
src/*/_*.scss
with_
? Whilesrc/*/*.js
are written without it.It causes problems to use standard BEM tools to work with files.
Is it possible to make consistent file names for all block techs (scss, js)?
cc @tadatuta