-
Notifications
You must be signed in to change notification settings - Fork 81
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
Additional scaffolding flavors for CoffeeScript, SaSS, SCSS #6
Comments
Thanks @benmgreene! Would love to have support for coffeescript, sass and scss. Any time to chip in? I don't have a great pattern for this but I did add support for less by just checking if the less package is installed. https://github.com/EventedMind/em/blob/master/lib/generators/view.js#L22 |
I think the package-check approach could definitely work for CoffeeScript, but Sass/SCSS is a bit harder... the Sass package is very broken right now. Of course with regards to SCSS, all it really would do is change the files ending, so nothing would be much easier than that! I'd definitely like to contribute a bit -- time is obviously in short supply, but I will endeavor to find some :-). |
On a somewhat related note, it'd be great to have the option of not create stylesheets at all when generating scaffolding/views (something like the "--no-stylesheets" flag from Rails). I use scss and I keep all those files in "client/sass/" with a more traditional stylesheet folder/file organization. I organize my styles based on functionality or general page location (ie header, footer, etc) rather than having a file for every view template. For example, I have a main.scss in the root of my sass folder that is used as a manifest that imports all of the rest of the files as partials (with the partials containing a preceding underscore in their filename to avoid separate compilation). File/folder structure like:
And then my client/sass/main.scss would look like:
The manifest approach gives me a really easy way to stay organized and to manage what is included in the final output from a single location. I realize the stylesheet structure I use isn't necessary in Meteor, but I find it to be much easier to stay organized than the stylesheets all over the place approach that is somewhat common for Meteor apps. I find that it also simplifies setups that use sass functionality like variables, mixins, etc across the entire project. Since I'm sure that creating em generator options for everyone's personal preferences isn't exactly a trivial task, I figured that having a way to exclude certain files based on a flag might be a useful option that wouldn't be too time consuming to add. What do you think? Thanks for the great tool Chris. It's a huge time saver for my workflow. |
Hey @jshimko, Thanks for the use case! Seems like a --no- |
I would like to echo @jshimko on the idea of a no-stylesheets flag for em. I am using less with Bootstrap and have a similar setup that he describes. I don't plan on populating the less files that em generates. I use a stylesheet organization that is very similar to what he describes, i.e., using a main with a series of imports. |
+1 for centralized scss/sass... and i'd definitely be wiling to put some time in if we can come up with a clean implementation plan that works for everyone em is an awesome initiative in general and i'd love to start using it asap |
+1 to the --no- |
Someone willing to take it on? I can help with design and reviewing code or even just where to start. |
I'd definitely be willing to put some time into this. It's something I would use regularly. I can obviously sift through the code to figure it out, but anything you can suggest to point me in the right direction would be a huge help. Thanks Chris! |
Thanks @jshimko! Take a look at lib/generators/view.js. A few things to note:
On the issue of whether to centralize the stylesheets as a standard practice. I wonder if we could have a few options for setting up your project structure. This would require that we have an em file in the project (maybe a .em folder with a config file in it). So one of the options might be where the stylesheets go. Or maybe we just provide different project structures all together. This would let people define their own if they want. I would also love to see the ability to use packages to extend the em command line tool, either with additional project layouts or other useful sub commands. But I admit this is a bit trickier :). It's on my list of things to investigate. Let's do devel work on the devel branch and keep master for releases. |
I'll be happy to chip in on this. I also have a couple of other ideas that might be worth consideration. |
I just submitted a pull request regarding this issue. A couple of things to note with this PR:
I like the idea of having a .em folder with a config file in it @cmather. It could get a little redundant typing in --no-resource every time you want to generate a view without css. Plus it would be pretty easy to map, for example, css config options into the commands and generators. Maybe a format like this:
|
Oh cool @scott-mcpherson! I'll try to set aside some time tomorrow to take a closer look. |
Hey guys, I've changed the code to use stylus and coffee. It's in my branch: It does not have all options you talked about, but it seems to work. |
FYI, I've went to a Hackathon this weekend and 4 people used my branch coffee without any problems. Today I've received a PR because I haven't added less on the branch. |
Yeah let's see a PR. How does it compare with the work Scott was doing? |
I've done something very simple and automatic. If you have the package coffeescript it will create coffee files. Only that. |
I have a somewhat flexible solution for this. I'd like to get this conversation going again and help get this feature added in. Can you guys check out this branch and let me know what you think. Instead of writing a few paragraphs about the features of this branch, I added an animated gif to illustrate them on the readme.md. https://github.com/scott-mcpherson/em/tree/config @gabrielhpugliese It looks like we're both working on similar things. If your interested and have time, maybe we can work together on this. |
@scott-mcpherson I like it! |
CoffeeScript is now being correctly rendered into the views. |
@scott-mcpherson Fantastic work! |
@JamesLefrere Thanks! I'd like to add more options in the |
@scott-mcpherson @cmather maybe this is off-topic but I would add a set of default packages and maybe also account hooks to the initial set of files. I've seen that Iron Router is required but not added by default. This sounds like it should be a default. |
@afuggini I agree, it would be nice to add some packages and maybe some hooks by setting some options in the config file, or possibly by default. One thing @cmather and I were talking about doing is possibly creating a master config file with options similar to what your suggesting. Maybe the way it would work is that when But yeah, this discussion probably deserves it's own "issue". Maybe we'll start a new discussion under milestones->Ideas and Design for this. |
Awesome idea. I started a new issue at #32, let's discuss! |
@scott-mcpherson I've tested your PR and your idea must be improved just a little now. |
@gabrielhpugliese I agree with you 100%: there needs to be a way to set defaults when running |
What about a npm release with this new and awesome coffeescript support? 😉 |
@mariomelo 0.1.6 has been released and is now available on npm. It includes coffeeScript, css preprocessor, and different template engine support. |
Amazing! Thanks, scott! |
It seems it isn't working properly. I added the coffeescript package and ran |
Love what you're building here, keep up the great work.
The text was updated successfully, but these errors were encountered: