Semantic-UI-Meteor icon indicating copy to clipboard operation
Semantic-UI-Meteor copied to clipboard

Automatically create files at first run

Open splendido opened this issue 10 years ago • 25 comments
trafficstars

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?

splendido avatar Apr 22 '15 07:04 splendido

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?

flemay avatar Apr 22 '15 08:04 flemay

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 avatar Apr 22 '15 08:04 splendido

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 :)

splendido avatar Apr 22 '15 08:04 splendido

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

flemay avatar Apr 22 '15 09:04 flemay

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?

splendido avatar Apr 22 '15 09:04 splendido

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

flemay avatar Apr 22 '15 11:04 flemay

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

jlukic avatar Apr 22 '15 20:04 jlukic

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

flemay avatar Apr 23 '15 04:04 flemay

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.

ghost avatar May 14 '15 15:05 ghost

@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.

bitIO avatar May 20 '15 09:05 bitIO

@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? :)

flemay avatar May 20 '15 09:05 flemay

@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

bitIO avatar May 20 '15 10:05 bitIO

@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:

  • Meteor starts
  • Whenever Meteor refreshes on any file changes

It generates the files when:

  • custom.semantic.json is different than .custom.semantic.json
  • custom.semantic.json is there but not .custom.semantic.json

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.

flemay avatar May 20 '15 10:05 flemay

@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

bitIO avatar May 20 '15 11:05 bitIO

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.

sergiotapia avatar Jul 10 '15 01:07 sergiotapia

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

flemay avatar Jul 10 '15 02:07 flemay

meteor add twbs:bootstrap

fvpDev avatar Jul 10 '15 02:07 fvpDev

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

flemay avatar Jul 10 '15 02:07 flemay

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 avatar Jul 10 '15 02:07 fvpDev

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

fvpDev avatar Jul 10 '15 02:07 fvpDev

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.

nooitaf avatar Jul 10 '15 02:07 nooitaf

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

fvpDev avatar Jul 10 '15 03:07 fvpDev

@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.

nooitaf avatar Jul 10 '15 04:07 nooitaf

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.

v3rron avatar Sep 02 '15 18:09 v3rron

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

nathanielks avatar Sep 29 '15 01:09 nathanielks