View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
13232Bug reportsTheme editorpublic2018-02-12 10:49
ReporterGabryxx7 Assigned ToLouisGac 
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version3.0.x 
Fixed in Version3.1.x 
Summary13232: Unable to load custom css and js
Description

I need to include some custom css and js files, and as the manual said I put the files under upload/themes/survey/{theme_name}/css and upload/themes/survey/{theme_name}/scripts, then I modified the config.xml file by adding

...
<add>css/file.css</add>
...
<add>scripts/file.js</add>
...

Even after reloading, the page, updating asset version and even deleting the folders inside the tmp/assets folder, nothing has changed.
The files are not loaded in the browser nor they are shown in the Theme Editor in the admin panel, even though I can see the other local files.

Steps To Reproduce
  • Copy theme
  • Add .css and .js files to the "upload/themes/survey/{theme_name}/css" and "upload/themes/survey/{theme_name}/scripts" folders
  • Add the file names to the config.xml file
  • Update asset version, reload page
  • Nothing happens and nothing changes
Additional Information

Is this the correct way to load .css and .js files? What if I need these files to be globally shared and available to every theme?

TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)Version 3.0.5+180118
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMYSQL v.5.5
Server OS (if known)Debian 6
Webserver software & version (if known)Apache
PHP Version5.6.32

Users monitoring this issue

There are no users monitoring this issue.

Activities

LouisGac

LouisGac

2018-01-24 11:28

developer   ~45971

manual should be updated: values in XML are pushed to DB.
Any change in the XML file now imply that you should uninstall and reinstall the Theme.
BTW: rather than copying a theme, you should extends it (via Theme Editor)

Gabryxx7

Gabryxx7

2018-01-24 13:36

reporter   ~45981

@LouisGac Good to know, thank you! How can I uninstall and reinstall the theme? I just extended the bootswatch theme and modified the new one!
And yes I extended it from the Theme Editor, I wrote it wrong :)

LouisGac

LouisGac

2018-01-24 14:13

developer   ~45988

from the themes list (Theme Box on homepage)

LouisGac

LouisGac

2018-01-24 14:13

developer   ~45989

https://manual.limesurvey.org/New_Template_System_in_LS3.x

Gabryxx7

Gabryxx7

2018-01-24 14:56

reporter   ~45992

I just uninstalled and reinstalled the extended theme (extended from Bootswatch), and not only it is still not loading the newly added .css and .js files the config.xml, but it's also not loading the custom.css and custom.js files (which are not empty, as shown in the Theme Editor and confirmed by looking into the server).

I am sure the extended theme is being used and loaded as I tried to put a {{ dump(aSurveyInfo) }} in the layout_global.twig file of the extended theme and when debug is set to 1 it actually prints the result.
But none of the .css and .js files in the config.xml file are not being loaded, they are nowhere in the html file nor they are loaded (checked with Google Chrome -> source)
I tried incrementing the version in version.php, and also setting debug to 1 or 0, deleting the cache and refreshing the page, but none of the .css or .js files in the config.xml file of the extended theme are being loaded.

Is there something I am missing or did wrong?

Gabryxx7

Gabryxx7

2018-01-24 15:17

reporter   ~45993

Nevermind, just uninstalled and reinstalled again, and it worked perfectly... I feel like eventually, this is always the best solution, how could I not think about it in the first place...
I guess something went wrong, I uninstalled the theme and immediately reinstalled it without checking first the survey theme options (i.e setting another theme, and setting back the extended theme once reinstalled)

LouisGac

LouisGac

2018-01-24 15:30

developer   ~45994

don't worry: your bug report is greatly appreciated.
the new theme system has a huge level of complexity and abstraction (3 different loops of infinite inheritance), so it could remain some hidden bugs here and there.
so feel free to ask for help to create your theme, to report all the non intuitive stuff, etc

Gabryxx7

Gabryxx7

2018-01-24 15:51

reporter   ~46016

I can see that, I dig deeper into the code, and it's quite complex, but definitely interesting. I switched from 2.7 to 3.0 some days ago, and I must say it was a HUGE improvement, I can modify litereally anything I want. I can get all the information I need regarding the survey, I can now create an index of the survey on the sidebar, customize and use the survey info on the page layout.

I managed to load all the .css and .js files I needed. But It would be nice to add an "update" button to the theme which would be triggered by a version on the config.xml file. Uninstalling and reinstalling the theme to reflect changes on the config.xml file is not intuitive!

If I may add, the .css and the .js file which I added in the config.xml file do not appear under the file list of the theme editor page!

LouisGac

LouisGac

2018-01-24 16:37

developer   ~46031

yep an update button is a good idea.
can you create a feature request?

c_schmitz

c_schmitz

2018-02-09 17:02

administrator   ~46371

Version 3.3.0 released

Big_Lemon

Big_Lemon

2018-02-10 15:34

reporter   ~46383

The problem still exists local. It seems only to work on production.
If I try to develop themes locally to push them on production, I use $php -S localhost:8000.
But the custom.css file is still missing. I do the same as discribed above. With debug mode on, the same problem.
In head it has the custom.css from vanilla and not my own from upload/themes/...
This is only a problem with custom.css. Theme.css does work.

LouisGac

LouisGac

2018-02-12 10:49

developer   ~46386

Big_Lemon:

if you're using the Theme Editor, the save button now regenerate the assets:
https://github.com/LimeSurvey/LimeSurvey/commit/bcda36f1170d6ffeae88003a34eb0b4b48f99c3b#commitcomment-27500363

If you're not, you will now find a button to regenerate the assets in global settings:
https://github.com/LimeSurvey/LimeSurvey/commit/b6df690ecac2a456443fed60c5c191b0cef827d0

Issue History

Date Modified Username Field Change
2018-01-22 17:17 Gabryxx7 New Issue
2018-01-24 11:28 LouisGac Note Added: 45971
2018-01-24 13:36 Gabryxx7 Note Added: 45981
2018-01-24 14:13 LouisGac Note Added: 45988
2018-01-24 14:13 LouisGac Note Added: 45989
2018-01-24 14:56 Gabryxx7 Note Added: 45992
2018-01-24 15:17 Gabryxx7 Note Added: 45993
2018-01-24 15:30 LouisGac Note Added: 45994
2018-01-24 15:51 Gabryxx7 Note Added: 46016
2018-01-24 15:55 c_schmitz Assigned To => LouisGac
2018-01-24 15:55 c_schmitz Status new => assigned
2018-01-24 16:37 LouisGac Note Added: 46031
2018-01-26 14:13 LouisGac Status assigned => resolved
2018-01-26 14:13 LouisGac Resolution open => fixed
2018-01-26 14:14 LouisGac Fixed in Version => 3.1.x
2018-02-09 17:02 c_schmitz Note Added: 46371
2018-02-09 17:02 c_schmitz Status resolved => closed
2018-02-10 15:34 Big_Lemon Note Added: 46383
2018-02-12 10:49 LouisGac Note Added: 46386