gss / engine

GSS engine
http://gss.github.io
MIT License
2.86k stars 105 forks source link

using gss with meteorjs #111

Open ccorcos opened 10 years ago

ccorcos commented 10 years ago

I'm interested in checking out GSS. I'm curious how far along it is -- is this something I could use in production right now? Are there any noticeable shortcomings?

Anyways, does GSS compile down to CSS? or does it respond to events and move everything with jquery?

paulyoung commented 10 years ago

I'll try to answer your questions based on what I know.

using gss with meteorjs

I'm not aware of any issues specific to Meteor but you might encounter some more general issues until 1.0 lands.

I'm curious how far along it is

The current version is in beta but there are some major changes in progress before we drop the beta tag.

is this something I could use in production right now?

We're currently using GSS in several production sites.

Are there any noticeable shortcomings?

I've experienced issues with plural selectors and volatile DOM. Both should be addressed in an upcoming release.

I don't think GSS currently supports pseudo selectors or Shadow DOM.

does GSS compile down to CSS?

There is gss2css for compiling GSS to CSS. I'm not personally up to speed on the status of the project.

does it respond to events and move everything with jquery?

Put simply, "yes" - GSS responds to events. Resizing the browser window is one example. The upcoming release is better at changes to the DOM.

jQuery is not a dependency of GSS.
Hope that helps!

ShimShamSam commented 10 years ago

I'm writing a Meteor package to compile gss files. The current issue I've come across is since GSS is not a standard web file (CSS, JS, HTML, etc...), Meteor doesn't know how to deal with it in terms of concatenation and serving. Doing it manually means registering a file with Meteor as a servable asset, but this can only be done during a compile iteration, which runs once per file (in my case, once per GSS file). Meteor currently doesn't offer any sort of end-compile handler, so I don't know when I've processed the last file and can concatenate all the files and register the contents as a single asset.

My naive solution was to keep registering the same asset over and over, each time with the newly iterated file's contents appended to the end. However, Meteor doesn't allow you to add the same asset over and over, so I'm stuck.

The simplest solution is to register each gss file as its own asset, but that means the browser has to make lots of requests, especially since both the browser and gss.js make a request for each

Another solution is to manually search the file tree for .gss files, but that's reinventing the wheel since Meteor is supposed to do that for you. Further, I'd have to emulate Meteor's "deepest folder first" file ordering

paulyoung commented 10 years ago

I don't know much about Meteor, but maybe you can create a HTML file / partial which only contains a style tag:

<style type="text/gss">
  ...
</style>
ShimShamSam commented 10 years ago

That's not a bad idea. I will try it. The downside is caching is ruined.

ccorcos commented 10 years ago

@Knotix, thanks for taking up the challenge! Check out how meteor implemented this for compiling less files:

https://github.com/meteor/meteor/blob/devel/packages/less/plugin/compile-less.js

so it looks like you can register .gss files with Plugin.registerSourceHandler("gss"...

ShimShamSam commented 10 years ago

@ccorcos Yeah, I've already gotten that far. The LESS compiler is simply compiling the files to CSS, which is then concatenated/minified by Meteor, which I think is done internally. Since GSS doesn't compile to CSS and must be served "as is", it's not as easy as running it through a compiler and letting Meteor do the rest. It would seem the way Meteor isn't conducive to certain types of compilation.

I'm still working on it. I started a few posts in Meteor-talk that might point me in the right direction.

ccorcos commented 10 years ago

i see. does GSS compile to javascript?

ShimShamSam commented 10 years ago

No. The GSS engine finds all and