Adapt_framework: Changing Dest of menuAssets in Grunt task

Created on 21 Nov 2017  路  13Comments  路  Source: adaptlearning/adapt_framework

Currently in grunt/config/copy.js menuAssets dest is set to dest: '<%= outputdir %>assets/' this should be brough into line with menuFonts, themeFonts and themeAssets that all point to Adapt/css/[respective-folder]for example themeAssets has dest: '<%= outputdir %>adapt/css/assets/'

All 13 comments

i think all of the asset folders should go to adapt/css/assets not just menu and theme.
it seems silly to have two asset folder locations as we do at the moment. one at build/assets and one at build/adapt/css/assets.

this would mean we could stop having to write LESS which back references the root assets folder such as:

    .mejs-overlay-button {
        background-image: url(../../assets/bigplay.svg);
    }

we could instead use:

    .mejs-overlay-button {
        background-image: url(assets/bigplay.svg);
    }

there isn't a proposal where we could change the location of this folder without breaking any existing plugins. except by duplicating the assets over both folders and making the build/assets folder redundant at the next major version.

Another (breaking change) approach could be to move adapt.css to the root. Seems very superfluous to have a CSS directory with only ever one CSS file.

I had a little more of a think around this...
Assuming that:

  • we want to unify the assets folders
  • stop code from breaking
  • warn people to update their code

We could probably:

  • get grunt to output all assets to adapt/css/assets (or move the adapt.css and invert that)
  • add a less preprocessor to warn of occurrences of ../../assets/ in the LESS source files by path
  • after the less is compiled into css, add a css postprocessor to correct the occurances of ../../assets/ to assets/

that way all the existing code would keep working, people would get warned about deprecated code and we'd get the result we want.

any thoughts on this @ciaranlp ?

I like the idea of having all assets in one place and the css file moved to root

cool. we'd have to move the font and assets folders to root, but that's quite doable.
it would be easier in the first instance to unify them into adapt/css/assets, as fewer things have to change, but i'll happily unify them at /assets instead if we can all agree

any objections? @moloko @brian-learningpool @lc-thomasberger @tomgreenfield @taylortom @dancgray @danielstorey

Changes required

When moving root/adapt/css/adapt.min.css to root/adapt.min.css

  • All index.html s need changing as this file is referenced directly (or add post processor?)
  • Change grunt to output all fonts to root/fonts/ instead of root/adapt/css/fonts
  • Change grunt to output all assets to root/assets
  • Add less preprocessor to change "../../assets/" references to "assets/" and warn about deprecation

@ciaranlp can you have a look at the above pr? see if that helps.
don't install spoor to test, i haven't done a pr for the link tag change in spoor yet.
i've added a backward compatibility function to scriptLoader.js to deal with old css urls but i need to pr to spoor to fix the old urls.

Yes @oliverfoster will do

Ta man. Let me know if it's not suitable as a solution to your specific issue. I'm trying to solve your problem along with the outstanding double assets folder issue at the same time.

@oliverfoster all seems to be working dandy! +1

Prompts:
screen shot 2018-01-25 at 10 46 10

1 LESS file from prompt
screen shot 2018-01-25 at 10 49 11

Paths fixed after compilation
screen shot 2018-01-25 at 10 49 24

Thanks @nilslp - I'll fix it so it only outputs one error per file. That should be enough.

Was this page helpful?
0 / 5 - 0 ratings