Open buschtoens opened 6 years ago
Hi @buschtoens! That's an interesting idea.
Up to this point, paths used with @value
/composes
have always worked the same way as import
in JS, so for instance if I wanted to extend a component, I'd have to include the /component
at the end of the import path.
The general pattern we tend to follow is to basically treat the contents of <component-name>/styles.css
as private, and move anything we want to share into more centrally-located modules with descriptive names (e.g. @value grid-padding from 'my-app/styles/layout'
or composes: danger from '@salsify/base-styles/buttons'
)
That said, if we wind up with a solution for #90, wanting to reference things in styles
files may become more common... 🤔
When using pod style components it's a bit tedious to always have to append
/styles
to the import path for@value
andcomposes
.If the given path resolves to a directory, e-c-s should automatically try to load a
styles.${defaultExtension}
file from it. This way the user can omit/styles
.For instance:
becomes:
The only complication I can see is, that
resolve-path.js
currently does the resolution synchronously without accessing the file system.