Comments (6)
Hey @rstacruz do you have a use case I can take a look at?
from node-sass-import.
Yep! http://rscss.io
On Fri, Sep 30, 2016, 7:43 AM Emmanuel Addo Narh [email protected]
wrote:
Hey @rstacruz https://github.com/rstacruz do you have a use case I can
take a look at?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#9 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEikdNRnQzQcVECKk6MqjHFqkeTBYHQks5qvE0agaJpZM4JvYIo
.
from node-sass-import.
@rstacruz very nice work on rscss!! I'm going to try and add this feature.
from node-sass-import.
Hey @rstacruz,
So after trying a few scenarios, it appears the easier route might be using some entry file (index.scss) to import/list all the necessary files needed vs. going the glob (/) route. The reason behind this is because I'm using the resolve module to lookup files in both the npm & local filesystems. That resolve module unfortunately does not take raw globs for lookups for now. Adding that feature would require prior knowledge through the '@import url' as to whether the '@import url' (e.g. @import somecss/) is referring to a local lookup or an npm(node_modules) lookup. I didn't want to add some form of symbols (e.g. ~) to indicate that it's an npm module because that approach is an anti-pattern approach. And because I wanted to stay true to the npm patterns (require), I offloaded the lookup to the "resolve" module to do the dirty work of figuring out the location of the '@imported' files regardless of where they may be located just like with javascript "require".
Let me know if you have some thoughts or suggestions around getting your proposal to work while still maintaining the patterns. In most of my work, I always use an entry file that lists all the files individually. I also see most folks and libraries doing the same. But I do recognize the appeal to not having to list all the files by hand if you don't have to.
from node-sass-import.
Hm, lemme think about it and try to hack around it.
On Mon, Oct 3, 2016, 9:45 AM Emmanuel Addo Narh [email protected]
wrote:
Hey @rstacruz https://github.com/rstacruz,
So after trying a few scenarios, it appears the easier route might be
using some entry file (index.scss) to import/list all the necessary files
needed vs. going the glob (/) route. The reason behind this is
because I'm using the resolve module to lookup files in both the npm &
local filesystems. That resolve module unfortunately does not take raw
globs for lookups for now. Adding that feature would require prior
knowledge through the '@import https://github.com/import url' as to
whether the '@import https://github.com/import url' (e.g. @import
https://github.com/import somecss/) is referring to a local lookup or
an npm(node_modules) lookup. I didn't want to add some form of symbols
(e.g. ~) to indicate that it's an npm module because that approach is an
anti-pattern approach. And because I wanted to stay true to the npm
patterns (require), I offloaded the lookup to the "resolve" module to do
the dirty work of figuring out the location of the '@imported
https://github.com/imported' files regardless of where they may be
located just like with javascript "require".Let me know if you have some thoughts or suggestions around getting your
proposal to work while still maintaining the patterns. In most of my work,
I always use an entry file that lists all the files individually. I also
see most folks and libraries doing the same. But I do recognize the appeal
to not having to list all the files by hand if you don't have to.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#9 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEikXpCkesbjVTDvNyT5m5usZzkR5j-ks5qwF45gaJpZM4JvYIo
.
from node-sass-import.
I don't think there needs to be a special symbol or anything. All that needs in the module's logic is to do something different if it matches more than 1:
// pseudo-code
files = glob('components/*')
if (files.length === 1) {
return { file: files[0] } /* eg, 'components/button' */
} else {
return { contents: '@import "components/button"; @import "components/form";' }
}
Looking at the code, this isn't so simple because you need to do async.parallel among the resolver()
calls, so there's some internal API rearranging that needs to happen, but it's possible :)
from node-sass-import.
Related Issues (10)
- Error HOT 2
- Update project description HOT 2
- Document globbing support
- Fallback to bower.json HOT 1
- change importer to support '~' HOT 3
- Fails to build in Windows 10 HOT 4
- Import script should consider looking at the "style" and "sass" declarations HOT 4
- Need to be able to import local scss files as well. HOT 5
- Remove .css extension HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-sass-import.