-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Including 'sass.sync.js' in Bower #32
Conversation
Thank you for your effort and interest in this. I am very reluctant to making this happen, because the sync module is the wrong approach for a browser. It can be the equivalent of If you can live with the user having to provide |
Agreed, and I would also be reluctant to hog the main event loop. With the sync approach, I was simply going to check for Maple also doesn't expose any public API — there's no <script type="text/javascript" src="vendor/maple/maple.js" data-sass="vendor/sass/sass.js"></script> Thus you can see why checking for I'd really appreciate some suggestions on how to tackle this! Edit: Would also like to point out that this would be purely for development where blocking code is not necessarily the end of the world. |
Sass.js did extactly that in the very beginning. in 0.9.0 the API will change to require you to actually instantiate a new Sass instance
When has such a limitation ever stopped someone from pushing things into production?
I wrote about Identifying the current If things are development only, and you know the environment (e.g. use of bower is required), then you should also know the path from where to load, no? You may try using the most common path to load from and allow the user to change that configuration where needed. That may keep it simple for the 80%, but not screw the other 80% ;) |
Thanks – will have a think about this. I personally always change from the default |
What's your position on having Sass.js attempting to resolve its worker? Essentially that's what I'll be doing. However, in my case there will be two incertitudes:
Whereas if Sass.js were to assume a default if you write |
I don't understand where your first uncertainty comes from Not wanting to dictate anything, Sass.js made this part configurable. I'm not sure how I would resolve anything without knowing the exact setup the user has. In my case for example, sass.js is pulled in via require.js and dumped into a file with everything else - except for the worker. The worker is moved somewhere else during build, than it was pulled from in development mode. But I am open to suggestions and discussion. |
First uncertainty comes from not being able to reliably locate the In my case, I'm trying to transparently use In that case, we could resolve the path that constructor(workerPath) {
var worker = new WebWorker(workerPath || defaultWorkerPath);
} If both I realise it's quite specialised and so unlikely to be included as part of |
I'm not happy with how things are right now. Littering // we can only run this test in the browser,
// so make sure we actually have a DOM to work with
if (typeof document !== 'undefined' && document.getElementsByTagName) {
var currentScript = document.currentScript || (function() {
var scripts = document.getElementsByTagName('script');
return scripts[scripts.length - 1];
})();
var defaultWorkerUrl = currentScript.src;
// make sure we're not running in some concatenated thing
if (defaultWorkerUrl.slice(-8) === '/sass.js') {
// this may look ugly, but the browser will resolve that path before talking to a server
Sass.initialize(defaultWorkerUrl + '/../sass.worker.js');
}
} That should work for any scenario loading the unmodified Sass.js in |
tested it, liked it, will commit it after dinner :) |
👍 Any luck? |
writing testing and committing, yes. pushing to github, no. my hotel's wifi is weird that way. it has no problem with torrent, but don't you dare using SSH… |
… If you try often enough… successfully pushed to master. As I haven't release 0.9.0 yet, you'd need to build sass.js locally to test. How quickly do you need this to be available through regular channels? |
Thanks! No problem – I can point to the |
actually you can't, as the |
Ah! In that case, it would be lovely to have it as soon as possible – although I'm happy to build manually for the time being if you want to hold off on the minor increment. I think it all depends on when you're expecting custom functions to arrive. |
If I can't land it before Friday, I'll release 0.9.0 without it, ok? |
Purrrfect 🐱 Thanks for your help, Rodney! |
I didn't get the chance to work on the custom functions stuff, so I released 0.9.0 a moment ago. Thank you for your support! |
Ah, nice! Thanks! 👍 |
Including the
dist/sass.sync.js
in the Bower registry. I realise it's not recommend for production, but in my case I want to provide basic inline SASS support for development – when working with my newly created Maple framework. Alternatively I could use theWebWorker
but for development the configuration path required is an additional complication, and something I'd need to document. Usingdist/sass.sync.js
the developer merely needs to include it as ascript
, as opposed to configuring Maple 👍