User tests: Successful: Unsuccessful:
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.
Labels |
Added:
?
|
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-09-03 10:21:38 |
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
#3709Personally 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/
Reopening because the other PR is backend and this one is frontend.
Status | Closed | ⇒ | New |
I think we should do the file_exists check with the full path:
JPATH_SITE . "/templates/protostar/css/custom.css"
In that case all references to $this->template should be removed. How about that?
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.
I agree @phproberto Change has been comitted.
Tested. Seems to work ok before and after the last commit
Good job Roland!
Status | New | ⇒ | Pending |
Not sure this would be B/C as some may have created a specific custom.css for TinyMCE only.
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.
It could break the template easily as someone may need specific css just for Tiny, and this custom.css would override the template.css
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...
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?
You can't use Tiny specific tags in the custom.css?
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
Thanks for the explanation. I now understand what you mean.
Category | ⇒ | Templates (site) |
Closing this as there seems to be no way around it nor any interest.
Status | Pending | ⇒ | Closed |
Closed_Date | 2014-09-03 10:21:38 | ⇒ | 2014-09-27 15:11:54 |
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?
Status | Closed | ⇒ | New |
Is the only problem the name custom.css?
If so then I would go with local.css or user.css
Seems easy enough
From what I understand what @infograf768 wrote it is indeed the name custom.css that is the problem here. Can you confirm @infograf768 ?
If thats the case then its an easy and useful addition
@roland-d May I propose another way to solve this problem?
Here is my thought:
Introduce an empty less file e.g. isis/less/user.less
Edit template.less to include this new file at the end (same for the rtl)
Provide a button on the backend so admin can recreate the template.css, template-rtl.css
This way we will not introduce one more http request and users can always get some custom css served!
Thats not a good idea. Running the less compiler on a live " low resourced
shared" server is a guaranteed way to kill your account.
On 20 January 2015 at 22:12, Dimitris Grammatiko notifications@github.com
wrote:
@roland-d https://github.com/roland-d May I propose another way to
solve this problem?
Here is my thought:
Introduce an empty less file e.g. isis/less/user.less
Edit template.less to include this new file at the end (same for the rtl)
Provide a button on the backend so admin can recreate the template.css,
template-rtl.cssThis way we will not introduce one more http request and users can always
get some custom css served!—
Reply to this email directly or view it on GitHub
#4211 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
@brianteeman The less compiler will be required to run only once, I didn’t mean "run less compiler for every request". But anyhow I haven’t benchmark this, so you might be right.
I understand you but users will make a change- compile make a change -
compile make a change - compile etct - trust me - seen it happen too often
on too many sites - it kills poor hosts
On 20 January 2015 at 22:25, Dimitris Grammatiko notifications@github.com
wrote:
@brianteeman https://github.com/brianteeman The less compiler will be
required to run only once, I didn’t mean "run less compiler for every
request". But anyhow I haven’t benchmark this, so you might be right.—
Reply to this email directly or view it on GitHub
#4211 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
I still don't see what the problem is we're trying to solve. There are various extensions on JED which allow to do just that. And they are all better than what we would do here.
From what I understand what @infograf768 wrote it is indeed the name custom.css that is the problem here. Can you confirm @infograf768 ?
yep.
There are various extensions on JED which allow to do just that. And they are all better than what we would do here.
There are indeed quite a few in
http://extensions.joomla.org/category/style-a-design/templating
I still don't see what the problem is we're trying to solve.
The problem is that users can't add their own CSS styling to Protostar without having to use a 3PD extension or hack the Protostar template. The majority of templates have such an option and it is almost standard to have a custom css file users can edit.
And they are all better than what we would do here.
I think we can offer the simplicity of custom css file, if users want more they can use an extension. Having to use an extension for a 4 line change seems overkill to me.
Agree. Were spending more time discussing it than it will take to
write,tear,document and comit
On 21 Jan 2015 09:09, "RolandD" notifications@github.com wrote:
I still don't see what the problem is we're trying to solve.
The problem is that users can't add their own CSS styling to Protostar
without having to use a 3PD extension or hack the Protostar template. The
majority of templates have such an option and it is almost standard to have
a custom css file users can edit.And they are all better than what we would do here.
I think we can offer the simplicity of custom css file, if users want more
they can use an extension. Having to use an extension for a 4 line change
seems overkill to me.—
Reply to this email directly or view it on GitHub
#4211 (comment).
Anyhow, we would also need a rtl one I guess.
And the name anyway should be changed.
I will update the PR with the needed changes.
Without adding a Parameter, this would be a hidden feature....
No, we don't. We just need to document it, IMO there is no need for a parameter to tell the template to scan for an optional custom CSS file.
A common thing done by many template clubs is to have a check for a custom
css file > 0k
If it is >0k then the file is included otherwise it isnt
So no need for any parameter. If it has content then it is used. If it has
no content then it is ignored
Ok, I have updated the name of the file and check if the size is larger than 0. Once this is merged I can write the documentation for it.
As for needing an RTL one, I think this is not needed as RTL specific changes can be put in this file as well because it is the last file loaded, so it will always be applied.
Are the travis errors on this PR related to the PR or the Unit Tests
@brianteeman I don't see any errors on this PR?
Travis says it fails
On 4 Feb 2015 15:05, "RolandD" notifications@github.com wrote:
@brianteeman https://github.com/brianteeman I don't see any errors on
this PR?—
Reply to this email directly or view it on GitHub
#4211 (comment).
Not the last commit from what i can see. I think you missed the most recent two
Ah I was going by the one at the top of this page on issues.joomla.org
On 4 February 2015 at 15:15, George Wilson notifications@github.com wrote:
Not the last commit from what i can see. I think you missed the most
recent two—
Reply to this email directly or view it on GitHub
#4211 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
@brianteeman I wonder if that is a bug of JIssues not updating the status.
Yeah I've raised that as a bug
@test
Created a user.css using the template manager
Tested it is loaded after template.css
Tested it is not loaded if empty
All good
Status | New | ⇒ | Ready to Commit |
Moving RTC thanks for testing. Can someone add the New Feature
and RTC
label?
Setting RTc - thanks
Labels |
Added:
?
|
Labels |
Added:
?
|
Milestone |
Added: |
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
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
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 2014-09-27 15:11:54 | ⇒ | 2015-07-11 13:44:38 |
Closed_By | ⇒ | mbabker |
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
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 ;)
@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.
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.
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.
ok great!
Thanks
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).
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
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
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)
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).
Guys this isn't the place to be talking about 3rd party plugins ;) Please take it off this thread :)
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).
It's been closed since August ;)
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.