Semantic-Org / Semantic-UI-Meteor

Official Semantic UI Integration for Meteor
MIT License
224 stars 33 forks source link

Automatically create files at first run #2

Open splendido opened 9 years ago

splendido commented 9 years ago

To make the DX (developer experience) even better, I'd propose to automatically create the file custom.semantic.json in some conveniente folder (...client/vendor/sui?) with the default content and create all other required files from the very first run.

After this initial automatic setup, any change to the custom.semantic.json file would trigger files recreation exactly like it's already happening.

Thoughts?

flemay commented 9 years ago

I really like having control where I want to put the files by creating custom.semantic.json wherever I want.

However, it might be nice to have the files that should not be changed in an other folder (client/vendor/sui). But for people who know how semantic works they might want it to be the way it is now (consistency with semantic ui). custom.semantic.json could have sitePath and semanticPath to allow customisation.

Where would you put the code to create automatically the custom.semantic.json?

splendido commented 9 years ago

I haven't look well at your script yet, but I'd say in the very same place where you check whether it already exists or not: if you don't find it you'll have to create it ;-)

Perhaps here

splendido commented 9 years ago

I really like the idea of needing only meteor add samantic:ui the get SUI up and running.

Theming and customizations might come later on when there's already some structure in the app, but adding the LESS version form the beginning without having to worry too much about it would be a plus :)

flemay commented 9 years ago

Just to explain, the package (plugin) will only be triggered when there is a file custom.semantic.json.

splendido commented 9 years ago

I see, this part is still unclear to me, I've never played with build plugins :(

do you know whether there's a way to add also a regular js file to the package which looks for files within the app and possibly creates new ones?

flemay commented 9 years ago

No idea. I want it not to be too complex neither. MVP :)

jlukic commented 9 years ago

Be sure to give me a ping when semantic:ui is available, i'd like to tweet about it.

flemay commented 9 years ago

@jlukic The packages are already available on atmosphere! :)

ghost commented 9 years ago

I created a dummy meteor app, added semantic:ui and flemay:less-autoprefixer, and start my meteor app -- but can't get s:ui to generate anything. I tried touch custom.semantic.json, then started app again. Still nothing. What am I doing wrong? Any help would be greatly appreciated. Using latest version of meteor 1.1.0.2.

bitIO commented 9 years ago

@df-sean I think it's explained https://github.com/Semantic-Org/Semantic-UI-Meteor/issues/4 you just need to remove the dot file .custom.sematic.json and restart meteor.

flemay commented 9 years ago

@df-sean Also your file custom.semantic.json should now be populated after you started the app. Is there anything missing/unclear in the readme usage section? :)

bitIO commented 9 years ago

@flemay It's a bit unclear in the README (at a first glance, I had the same issue) since it needs two rounds, one to fill the custom.semantic.jsonand other without the dot file. Please, correct me if I'm wrong, but the workflow goes like this:

  1. create and empty custom.semantic.json
  2. run Meteor so the file gets populated with the defaults (1st round)
  3. remove the dot file (it will generate everything) (2nd round)

Just my two cents

flemay commented 9 years ago

@bitIO Thanks for your feedback.

You can create the file when meteor is running and it will populate it.

The key is to understand when semantic:ui gets triggered and when it generates the files!

It gets triggered when:

It generates the files when:

Therefore you don't need to restart Meteor to generate the files. You could for instance change any value in .custom.semantic.json and change one of your file in your app and semantic:ui will generate the files.

bitIO commented 9 years ago

@flemay Yep, you're absolutely right. I just added the restart phase just to be a little bit more clear on how it works. Would you add such an explanation to the README? Or maybe I can do it and send you a PR

sergiotapia commented 9 years ago

Developer experience should be similar to Twitter Bootstrap's package. You add the meteor package and you have everything working with no extra steps needed.

flemay commented 9 years ago

Do you have the link of Twitter Bootstrap's package? :)

fvpDev commented 9 years ago

meteor add twbs:bootstrap

flemay commented 9 years ago

Can you tell the package I want only this and this elements and not generating everything?

fvpDev commented 9 years ago

I feel like the reason that "the package (plugin) will only be triggered when there is a file custom.semantic.json" is to preserve, as much as possible, the flexibility of being able to organize the file structure to a Meteor app however one likes, and to have the ability to put files wherever one wants...and personally I believe it makes sense to create a defined folder structure to an application and providing route paths and all of the rest of the backbone to the app before getting into templates and design (html/js/css) of the visual part of the application anyway. So that by the time one is ready to get into the design of the visual part of the app, they already have a set place where they would like to set up their less and js files, and can therefore create the custom.semantic.json file.

Oh, and yes; Semantic UI becomes tremendously customizable when it comes to components and being able to include all of the code in the folder structure outside of the .meteor folder, and therefore have a place for one to be able to trigger which components they want to include in their application, so as to not have arbitrary code that isn't being used in the app, just taking up space.

fvpDev commented 9 years ago

^by "html/js/css" files I mean the the files one creates for the visual components in the app

nooitaf commented 9 years ago

if you want a package thats works 'out of the box' you might want to consider using the css version of semantic ui https://atmospherejs.com/semantic/ui-css or meteor add semantic:ui-css

semantic:ui on the other hand uses less and is similar to the bootstrap less package https://atmospherejs.com/nemo64/bootstrap which also needs some additional steps to work.

fvpDev commented 9 years ago

@nooitaf Am I understanding that correctly? (what I wrote above)

nooitaf commented 9 years ago

@fvpDev how would i know? My comment was more or less general to the UX. As i understand it, there are people that just want to add a package and start playing with the default semantic theme and elements. Even though adding one empty file is not much work to get it going, the auto-generated files might add some overhead/confusion which might not be needed if you just want to try something out.

I prefer the semantic:ui package ofc and i think its a great solution <3 but you might have to dig a bit deeper into how less and semantic-ui works.

v3rron commented 9 years ago

it's especially annoying when updating the package on production environment. I use meteor up tool, and now I need to go manually to the production server to change a custom.semantic.json file just to regenerate version 2.1 files.

nathanielks commented 9 years ago

I've removed the .custom.semantic.json file and restarted meteor to no avail. Meteor 1.2.0.2. :(