gantry / gantry5

:rocket: Next Generation Template / Theme Framework
http://gantry.org
1.03k stars 204 forks source link

Enhancement: include a default `custom.scss` file in template installer #1531

Open alisamii opened 8 years ago

alisamii commented 8 years ago

I have noticed that one of the most common queries of users (both on the RT forums as well as in gitter) is How do I add a custom CSS file?.

It is possible to programatically include a default custom.scss file on install, and include a test to see if the file is installed already (for updates) and not overwrite it. I think it would reduce a lot of support headaches if a default file is installed (or added on update if missing).

The file should include the @import "dependencies"; directive at the top and nothing else.

mahagr commented 8 years ago

This is a good idea. The only small issue on this one is that we do not know how the file is named beforehand as it is specified by theme.

DanGthatRokGallery commented 8 years ago

I guess I'm playing devils advocate here. The extra coding to ensure a users carefully crafted 200 line custom SCSS file doesn't get overwritten on a template update is something I would seriously worry about. I still prefer guiding users to the Gantry Docs to create a custom SCSS file that WILL NEVER!!! be overwritten. I believe this task is even easier now that J36.x allows creation of SCSS files.

OptikWebCreative commented 7 years ago

@alisamii @mahagr I think this is a great idea, if the custom.scss file can be placed in the correct folder, on all 3 platforms J!, WP and GRAV, and have the content of the import, that file never changes names, and should be names the same across the board - it will certainly save a number of the questions in the chats / forums.

I would actually go one step further, and create the whole permitted folder tree in the custom folder.

@DanGthatRokGallery I dont see how this would be overwritten by theme SCSS as it would surely be the same as a user creating the file?

mariantanase commented 7 years ago

I agree with @DanGthatRokGallery

OptikWebCreative commented 7 years ago

@mariantanase I dont see that there would be any extra coding required, there isn't any extra coding required when I create a custom.scss file, that is all that is being suggested in this ticket (along with the folder structure if my comment is thought worthy)

maybe I'm being thick, but i dont see how any extra code is necessary

JoomFX commented 7 years ago

I'm with @DanGthatRokGallery about that one.

It is very easy to include the custom.scss file by default but then it will be overwritten whenever the template gets updated. I'm not sure what logic can be implemented to not overwrite it on update.

OptikWebCreative commented 7 years ago

@JoomFX if the custom folders are part of the rocket launcher rather than the theme, that would resolve the issue - i would suggest RL is where the file/folder tree should go not in a theme package

OptikWebCreative commented 7 years ago

but if it did go in a theme package wouldn't a IF Exists resolve the issue?

ghost commented 7 years ago

I'm with @DanGthatRokGallery too. Whatever the mechanics, adding a custom.scss somehow automatically leads to the possibility that a pre-existing file will be overwritten and therefore the possibility of losing your custom CSS changes. As it stands now that can never, ever, happen so your custom changes are safe.

With the recent Joomla changes it's easy to create custom.scss in template manager > templates > files and folders - so I don't really see the need to change anything.

OptikWebCreative commented 7 years ago

@marktaylor46 i agree, it is easier than ever to add the file, but some still struggle - hence my suggestion of adding it through the RL rather then theme, those who add just the theme hopefully are competent enough to add the file / folders themselves, and if RL adds them it all only be done at install as the RL isn't run as part of any update

If you're using an RL you're adding the platform as well, so it does kind of make sense to include the folders and sample custom.scss in RLs to me at least

ghost commented 7 years ago

i don't think we want to start doing different things in RL and standalone. We've just spent quite a while bring these into line too avoid confusion and makes things easier to maintain going forward. I still of am the opinion that this should not be changed but let's see what the DEVS think.

AmibeWebsites commented 7 years ago

I know it's unpopular but the conversation in #974 may be relevant.

Since creating a style field available on all blocks, containers and sections my custom.scss is getting smaller and smaller. Anything generic I use again and again is ending up as utility classes under Variations. My objective is to remove my own need for a custom.scss altogether because it can all be done as configuration under Settings.

Also, in reference to #1692, styling on blocks, containers and sections as setting configuration also allows for styling that gets loaded only where it's needed per layout.

Just saying... ;-)

mahagr commented 7 years ago

Its possible to add custom.scss file from Gantry itself when it detects a missing file. Including the file is a bad idea, though, as all the platforms will override all files present in zip file.

alisamii commented 7 years ago

Wouldn't it be possible to have the installer look to see if there is a custom.scss file present already (the location is very specific and never changes, so it could be tested for) and then if the test fails (no custom.scss) then create it, if the test succeeds (custom.scss present) it skips?

ghost commented 7 years ago

I think what Matias meant in his first answer, the filename is specified by theme, is that you can configure the filename that handle custom css, in my theme I can use anythingelse.scss, in this case custom.scss is useless, it wouldn't be picked up.

w00fz commented 7 years ago

Sorry but I don't like the idea of venturing in having logic to programmatically create the custom.scss file if it's missing. The custom.scss file is meant to be of the developer/end-user only, Gantry should only ever care about compiling it, the same goes for the whole custom/ folder. The risks of accidentally deleting/replacing that file due to a bug or change of behavior do not justify the benefit of having an empty file autogenerated, especially considering how easily anyone can create it.