I was about to release a CSScaffold module when I saw your module.
When I first implemented it, I had the same approach as yours, directly calling Scaffold::parse to compute the CSS.
But this is problematic since Scaffold uses classes as "Constants", "Extensions", and so on... and we cannot afford to steal these classes IMO (and potentially other functions).
That's why I ended using the CSScaffold index.php and leave the config in the config.php file instead of having configurable settings set in a variable.
Another technique would be to make a light bootstrap of Drupal just to have essential functions such as variable_get(), but in this case we need to fix the path of the CSScaffold library to be able to bootstrap since we need to include bootstrap.inc.
I'm willing to help if you want me to.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | csscaffold.zip | 4.29 KB | jide |
| #2 | csscaffold.zip | 4.91 KB | jide |
Comments
Comment #1
katris commentedI do understand where you are coming from... and agree.
I would be more then happy to have the help on this. (more/better eyes are a good thing hehe) :-)
The reason I went forward with this.. in this fashion, was I felt that since CSScaffold is its own framework, these issues are lower level to CSScaffold and should really be fixed at that level. I did branch the CSScaffold library here: http://github.com/katris/csscaffold from the most active fork I could find.
The other reason was that I wanted to maintain Drupal CSS caching/aggregation without affecting the style sheet loading order or priority. My first iteration was leveraging CSScaffold's index.php and when you turned on Drupal CSS aggregation... CSScaffold stopped parsing. There are two directions here that need research.
1. CSScaffold needs to define its own namespace for its Classes.
2. Drupal - not sure if this needs to change... I get the reason to have aggregation here, but also wonder that if a themer/dev is using a different CSS parser, why not just use that?
I did find that CSScaffold was not as portable as I would have liked to other platforms.
I would like to propose that CSScaffold leverage a definitive namespace for its Classes... like its doing for its actual processing funcitons: Scaffold_background_gradient... etc.
This would make the whole library much more portable and easier to use for beginners.
Definitely let me know your thoughts.
I haven't found any issues, or conflicts with other modules, other then the following: (which I'm going to patch today at some point)
1. When leveraging a subdomain at say ".com/mysite" as the base_path(). I had to update the docroot to be $root = $_SERVER['DOCUMENT_ROOT'] . base_path(); instead of just $_SERVER[DOCUMENT_ROOT].
I would love to see Drupal as a whole be able to provide better external CSS parsing and I'm not happy with the whole _preprocess_page... and then $vars['styles'] = scaffold_get_css();
- seems hacky to me :-(
I'm glad to see there is interest in this and "the more the merrier" in my book.
Let me know and we'll try and keep this prj rolling.
I'm completely sold on CSScaffold, but making the world play nice gets difficult... lol
Thanks for the input and offer and let me know your thoughts or if you find any definitive modules that are not compatible.
I'll make you a maintainer on this as well, just let me know your thoughts on my notes above about caching and what you think the best approach would be for moving forward.
:-) - sorry for taking so long to get back
Comment #2
jide commentedHey katris,
I totally agree, CSScaffold should really use namespaced classes, that would help a lot. Maybe we should speak about this with the author.
I did not find any module that could cause conflicts, but that could happen, and IMO that's a sufficient reason for avoiding this approach (that is, as long as classes are not namespaced). But I agree that being able to control the $config values is useful, to say the least.
In short, having control on the library is ideal and way better, but those damned classnames make it risky like this. But I am confident we can find a solution, and the more I think about it, the more I think we really need to be able to control the parser directly finally.
So to summarize our options for this issue :
I attached my own version of the module, which uses the second approach, so you can see how I did it. Aggregation works fine with both regular stylesheets and CSScaffold stylesheets.
About the ugly hook_preprocess_page and $vars['style'], we do not have an alternative, so that's the way to go, unfortunately ;)
There are other things we could consider that I implemented in my version of the module :
csscaffold[all][] = "css/style.css"
csscaffold[print][] = "css/print.css"
What do you think ?
If you want to add me as a maintainer, I'd be glad to help.
...And I'm a big fan of CSScaffold as well, such a brilliant thing, with hidden and undocumented treasures !
Comment #3
jide commentedI realized that Scaffold has been updated since I wrote the module, so it won't work. It's really hard to follow its development, moving so fast. Anyway, my comment above still stands.
Comment #4
jide commentedThat's the version I am talking about : http://github.com/anthonyshort/Scaffold/downloads. It seems the author started another rewrite. Damn ! Your module won't work either with this version, since the whole bootstrapping and parsing methods have changed. I'm trying to adapt your code to this release, but I'm not sure it's worth trying if the author keeps working on what seems to be a new version ? (It is tagged 0.0.8 on GitHub currently, and last commit was on 2010-06-26).
I am totally lost :
http://github.com/anthonyshort/Scaffold
http://github.com/katris/csscaffold
http://scaffoldframework.com/ - does not work !
Damn it !
Comment #5
jide commentedAbout the versions, on github the author says :
I have been using the module a little, had some issues and some more thoughts. I renamed the issue here since its scope goes beyond the initial discussion. Issues will go in separate issues.
Here is a summary of all the features I can think of :
csscaffold[all][] = "css/style.css"
csscaffold[print][] = "css/print.css"
BTW, I don't think a global switch for parsing themes stylesheets and module stylesheets is useful, since if module developers want to use scaffold stylesheets they could use csscaffold_add_css() and theme developers could use the .info file.
What do you think ?
And ehm, are you still around ? ;)
Comment #6
jide commentedI finally used my old version of the module, which uses the same approach as yours (that is directly calling the Scaffold class), but is not configurable yet (and is still very rough, but works well). Here it is.
We should merge our modules and join our efforts to try to make it feature complete.
Comment #7
katris commentedThis is great jide! :-)
I'm soo sorry for not getting back to you as fast as I would like.
I'm currently in a few big projects that are being pushed pretty hard, so my time suddenly dropped.
I've made you a maintainer so that you can get in here as well.
Check out the other guys that are helping to maintain as well.
We all work together at Treehouse Agency.
I'm downloading your zip file now, but will probably need to wait till this weekend to look through it.
One thing I do find is that scaffold seems to work best when leveraging a single style sheet and including all the secondary includes. This could cause us to rethink the implementation a bit, since this does fit inline with a single aggregated style sheet, but goes against the concept of everything including its own style sheets (modules/themes). Not a big deal for anything other then when you are in development mode.
Its funny, but I almost feel that the entire CSScaffold library would work very well as a Drupal CSS parsing module suite. However this seems like way too much redundant work and really turns CSScaffold in to a model rather then an applicable framework :-\ - However... I'm not totally against this idea. It may be the best way to internalize CSS parsing specifically for Drupal.
Sorry again for the late response, but I'm happy to set you up as a maintainer and I like your thoughts and agree with where you are going.
Let keep in touch. You've obviously put a lot of thought into this. Much more then I have in some areas :-)
I'll stay on top of our communications more and if you want to stop in and say hi to everyone, we have a public irc room (#treehouseagency) where you can say hi.
ttys
:-)
Comment #8
katris commentedThe more I think of it, the more I feel that this could be a very viable Drupal module suite.
I mean.. CSScaffold has a lot built in, but if we are only looking at CSScaffold because of its "already built" feature set, it seems that we could extract the fundamental concept from SASS or LESS (what-have-you) and allow the functional feature set to be truly extensible (for Drupal) by integrating it in the same way as Drupal currently implements its hook system.
Then we could provide a coherent system that can be extensible on many levels.
Comment #9
jide commentedHey katris ! Great to hear from you again.
Thanks for adding me as a co-maintainer, this will help to move things forward together. I've got a lot of professional work here too, but since Scaffold is an important part of the project I'm currently working on, I should invest some time on this.
I totally agree with your thoughts on the "module suite" thing. There are definitely good things that can be done around Scaffold that fit with the Drupal way of doing things. The ability to implement hooks to extend Scaffold is particularly valuable, I thought about this when I wanted to add "functions" to Scaffold processing. Another thing that I came across was conditional stylesheets for IE, having separate stylesheets is a problem with Scaffold. But I'm afraid there is no ideal solution for this - at least when you want to reuse existing mixins, constants...
Let's take some time to think about all this, I'll come to say hi to everyone at Treehouse on the IRC chan some time ;)
Comment #10
jide commentedOk ! I just commited a complete rewrite of the module to the CVS repo. It should be available as a development snapshot soon.
I had to remove and re-add the files to add keywords marking to the files.
Lots of things added / changed :
- Settings have moved to their own page.
- Constants can be set through the UI.
- Compatible with base themes.
- API to add Scaffold stylesheets through a function : scaffold_add_css().
- Ability to add Scaffold stylesheets from the .info file of the theme.
- Ability to call Scaffold files through an URL.
- Compatible with the libraries module.
- Displays parsing errors.
- Aggregation is handled differently. Should work fine with theme files, module files, with aggregation ON / OFF, with or without preprocessing.
Read README.txt for more information.
BTW, reviews are welcome !
Comment #11
katris commentedthanks for doing this jide :-)
Gonna move the documentation to a handbook page with these new updates and CSScaffold usage data.
Yes please check it out and all feedback is welcome.
:-)
Comment #12
jide commentedI am currently playing with lastest version of Scaffold (the ongoing rewrite), and good surprise, all classes have been namespaced !
Comment #13
katris commentedYeah... I saw that too.
Looks like everyone is moving in the same direction here.
:-)
Comment #14
jide commentedSetting this issue as fixed.