Skip to content

[imp] Add the ability to use a custom.css with Protostar.#4211

Closed
roland-d wants to merge 4 commits intojoomla:stagingfrom
roland-d:protostar-custom
Closed

[imp] Add the ability to use a custom.css with Protostar.#4211
roland-d wants to merge 4 commits intojoomla:stagingfrom
roland-d:protostar-custom

Conversation

@roland-d
Copy link
Copy Markdown
Contributor

@roland-d roland-d commented Sep 3, 2014

Currently it is impossible to use a custom.css file when using the Protostar template. A search on the net always ends up with a core hack of the index.php file, which could result in a problem when the index.php is being updated in a Joomla update.

This change checks if the file custom.css exists and if so, load it.

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Sep 3, 2014

A similar PR is open for the backend here: #3709

Personally I don't like using a custom.css and would rather use a plugin/module to do the same. There are many already existing which do exactly that and more.

@roland-d
Copy link
Copy Markdown
Contributor Author

roland-d commented Sep 3, 2014

Thanks @Bakual I did search but didn't find anything. Closing this in favor of #3709.

@roland-d roland-d closed this Sep 3, 2014
@brianteeman
Copy link
Copy Markdown
Contributor

I am a fan of this approach

On 3 September 2014 11:20, Thomas Hunziker notifications@github.com wrote:

A similar PR is open for the backend here: #3709
#3709

Personally I don't like using a custom.css and would rather use a
plugin/module to do the same. There are many already existing which do
exactly that and more.


Reply to this email directly or view it on GitHub
#4211 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Sep 3, 2014

Reopening because the other PR is backend and this one is frontend. 😄

@Bakual Bakual reopened this Sep 3, 2014
@phproberto
Copy link
Copy Markdown
Contributor

I think we should do the file_exists check with the full path:

JPATH_SITE . "/templates/protostar/css/custom.css"

@roland-d
Copy link
Copy Markdown
Contributor Author

roland-d commented Sep 3, 2014

In that case all references to $this->template should be removed. How about that?

@phproberto
Copy link
Copy Markdown
Contributor

Sorry I sent it from my smartphone. I mean:

file_exists(JPATH_SITE . '/templates/' . $this->template . '/css/custom.css')

Otherwise I think we can have problems with sites outside the root www.

@roland-d
Copy link
Copy Markdown
Contributor Author

roland-d commented Sep 3, 2014

I agree @phproberto Change has been comitted.

@phproberto
Copy link
Copy Markdown
Contributor

Tested. Seems to work ok before and after the last commit 💃

Good job Roland!

@infograf768
Copy link
Copy Markdown
Member

Not sure this would be B/C as some may have created a specific custom.css for TinyMCE only.

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Sep 10, 2014

Not sure this would be B/C as some may have created a specific custom.css for TinyMCE only.

If I understand it correctly, the worst thing that could happen is that the custom.css file is loaded always, while it currently would be loaded only when an editor is loaded (like in a form).
I don't think that could break a template.

Also it would only be the case if someone uses the Protostar template.

@infograf768
Copy link
Copy Markdown
Member

It could break the template easily as someone may need specific css just for Tiny, and this custom.css would override the template.css

@infograf768
Copy link
Copy Markdown
Member

Example:
The template wants some clear text on dark background (plain or with image). The template.css has been changed to obtain this. But editing in Tiny is easier when text is black over clear background or no background at all...

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Sep 10, 2014

But wouldn't that then break the template already currently when in a form with an editor? Or do you think they just don't care in that case but would if it spreads to the whole site?

Is that a generic TinyMCE feature that it loads the custom.css file if present?

@roland-d
Copy link
Copy Markdown
Contributor Author

You can't use Tiny specific tags in the custom.css?

@infograf768
Copy link
Copy Markdown
Member

PLG_TINY_FIELD_CUSTOM_CSS_DESC="Optional CSS file that will override the standard editor.css file. Enter a file name to point to a file in the CSS folder of the default template (for example, templates/beez3/css/). Or enter a full URL path to the custom CSS file. If you enter a value in this field, this file will be used instead of the editor.css file."

It is common to call that file custom.css is what I mean.
The classes in such a file are usually the same as in template.css, but with differences in rendering:
as said above, can be the colours or else:
for example

<p><span class="badge">test</span></p>

default css

.badge {
    display: inline-block;
    padding: 2px 4px;
    font-size: 10.998px;
    font-weight: bold;
    line-height: 14px;
    color: #fff;
    vertical-align: baseline;
    white-space: nowrap;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.25);
    background-color: #999;
}

if the template css has been changed to display "badge" black text on white background, the badge effect will not show in TinyMCE edit field. The custom.css will include a modified version (in that case the original css would fit)
I let you imagine sites where this has been done for dozains of css and site gets totally messed up because the custom.css is loaded in frontend

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Sep 11, 2014

Thanks for the explanation. I now understand what you mean.

@roland-d
Copy link
Copy Markdown
Contributor Author

Closing this as there seems to be no way around it nor any interest.

@roland-d roland-d closed this Sep 27, 2014
@roland-d
Copy link
Copy Markdown
Contributor Author

This topic came up again at the local user group. So I am thinking is, if custom.css can't be used, what if we change the name to something else for example user.css?

@roland-d roland-d reopened this Jan 20, 2015
@brianteeman
Copy link
Copy Markdown
Contributor

Is the only problem the name custom.css?
If so then I would go with local.css or user.css
Seems easy enough

@roland-d
Copy link
Copy Markdown
Contributor Author

From what I understand what @infograf768 wrote it is indeed the name custom.css that is the problem here. Can you confirm @infograf768 ?

@brianteeman
Copy link
Copy Markdown
Contributor

If thats the case then its an easy and useful addition

@zero-24
Copy link
Copy Markdown
Contributor

zero-24 commented Feb 4, 2015

Moving RTC thanks for testing. Can someone add the New Feature and RTC label?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4211.

@brianteeman
Copy link
Copy Markdown
Contributor

Setting RTc - thanks


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4211.

@brianteeman brianteeman added RTC This Pull Request is Ready To Commit Feature labels Feb 4, 2015
@wilsonge wilsonge added this to the Joomla! 3.5.0 milestone Feb 4, 2015
@ghazal
Copy link
Copy Markdown
Contributor

ghazal commented Jun 28, 2015

Why restrain this new feature to 3.5 ?
Tested in last 3.4.2RC, and it works allright. no big deal either.
As it is said earlier, now, it's common practice among frameworked templates to allow the ability to add a custom.css file to the template.
And, as Brian Teeman says, "So no need for any parameter. If it has content then it is used. If it has no content then it is ignored".
Furthermore, why add a third party extension to perform such a trivial action, very useful though.
To make it short, I think It would be a very nice addition to J!3.4.2

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Jun 28, 2015

Why restrain this new feature to 3.5 ?

Because according to SemVer, new features require a new minor version. So it will be 3.5. No big deal either 😄

@mbabker
Copy link
Copy Markdown
Contributor

mbabker commented Jul 11, 2015

Merged to 3.5-dev via 1f16717

@zero-24 zero-24 removed the RTC This Pull Request is Ready To Commit label Oct 14, 2015
roland-d added a commit that referenced this pull request Oct 24, 2015
[3.5] [imp] Add the ability to use a custom CSS file with beez3 & make the other similiar checks consistend see #4211
@haya1300
Copy link
Copy Markdown

haya1300 commented Nov 9, 2015

I prefer custom.css instead of user.css because in all documentation on the internet or in pdf docs there it is called custom.css. If you want to have properly documentation you must add this exception for the Protostar template in the documentation.
Also plenty Joomla users who are using the custom.css of the Protostar template on their website(s) it will not functioning any more and it must be adjusted after an upgrade to Joomla 3.5
Off course it can be fixed easily but that is not user-friendly.
This is the reason why I should prefer to call it custom.css

@zero-24
Copy link
Copy Markdown
Contributor

zero-24 commented Nov 9, 2015

@haya1300

Also plenty Joomla users who are using the custom.css of the Protostar template on their website(s) it will not functioning any more and it must be adjusted after an upgrade to Joomla 3.5

No. If it works bevor the update it will work also after the update. (e.g. via Plugin) If you use a core hack to make this work without a template copy this gets reverted every update anyway ;)

@roland-d
Copy link
Copy Markdown
Contributor Author

@haya1300 It is not possible to use the name custom.css because Tinymce will otherwise use the file and apply the CSS style to your editor window.

If you want to have properly documentation you must add this exception for the Protostar template in the documentation.

It doesn't have to be us. Joomla is a community, so you can do it as well.

@jjsjjs
Copy link
Copy Markdown

jjsjjs commented Feb 13, 2016

Am i correct that i only have to use/change the index.php to be able to use custom.css ?
Can i use it already in 3.4.8?
If so this is a great feature as i believe Protostar is one of the finest templates around.

@wilsonge
Copy link
Copy Markdown
Contributor

No it's going to be in Joomla 3.5 (you can look at the milestone on the right to see what version it will be in) - and it will not require any changes to index.php when it's introduced - you will just need to create your custom CSS file.

@jjsjjs
Copy link
Copy Markdown

jjsjjs commented Feb 13, 2016

ok great!
Thanks

@N6REJ
Copy link
Copy Markdown
Contributor

N6REJ commented Feb 14, 2016

You can use a custom.css with any template easily if you install my plugin
http://extensions.joomla.org/extension/jowwow-css-loader

On 2/13/2016 05:27, jjsjjs wrote:

Am i correct that i only have to use/change the index.php to be able
to use custom.css ?
Can i use it already in 3.4.8?
If so this is a great feature as i believe Protostar is one of the
finest templates around.


Reply to this email directly or view it on GitHub
#4211 (comment).

@jjsjjs
Copy link
Copy Markdown

jjsjjs commented Feb 16, 2016

Thanks a lot :)
I going to check it out right now.

If works ok i will write a review on the extensions page. This would be also a good candidate as a standard item for Joomla ;)
Please update the link to your plugin on the extensions.joomla.org page, thanks. it's a 404

@N6REJ
Copy link
Copy Markdown
Contributor

N6REJ commented Feb 21, 2016

@jjsjjs let me go do that really fast.. idky its not correct.

@thebeuving
Copy link
Copy Markdown

I am out of the office February 18th and 19th. If this is an emergency please call me at (209) 217-6400 and leave a voicemail if I don't answer, I will do my best to respond promptly.

I will reply to all non-emergency requests on Monday February 22st.

Thank you,
David Beuving

@N6REJ
Copy link
Copy Markdown
Contributor

N6REJ commented Feb 21, 2016

@jjsjjs updated

@jjsjjs
Copy link
Copy Markdown

jjsjjs commented Feb 21, 2016

Thanks Bear! Great plug-in. Worked instantly, no hasle. I will write a review this week on the extensions page under the pseudoname idnib (haha it's the reverse of my daughter's name)

@N6REJ
Copy link
Copy Markdown
Contributor

N6REJ commented Feb 22, 2016

Thanks... its been a long time since I updated it but it does everything
I can reasonably want it to do and now with the ability to add css file
right from within the template manager I dont' see the urgent need to
change it.
Bear

On 2/21/2016 15:58, jjsjjs wrote:

Thanks Bear! Great plug-in. Worked instantly, no hasle. I will write a
review this week on the extensions page under the pseudoname idnib
(haha it's the reverse of my daughter's name)


Reply to this email directly or view it on GitHub
#4211 (comment).

@wilsonge
Copy link
Copy Markdown
Contributor

Guys this isn't the place to be talking about 3rd party plugins ;) Please take it off this thread :)

@N6REJ
Copy link
Copy Markdown
Contributor

N6REJ commented Feb 23, 2016

just close the ticket george

On 2/22/2016 14:41, George Wilson wrote:

Guys this isn't the place to be talking about 3rd party plugins ;)
Please take it off this thread :)


Reply to this email directly or view it on GitHub
#4211 (comment).

@wilsonge
Copy link
Copy Markdown
Contributor

It's been closed since August ;)

@joomla joomla locked and limited conversation to collaborators Feb 23, 2016
@roland-d roland-d deleted the protostar-custom branch April 13, 2016 08:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.