adapt_framework icon indicating copy to clipboard operation
adapt_framework copied to clipboard

Changing Dest of menuAssets in Grunt task

Open ciaranlp opened this issue 9 years ago • 13 comments

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/'

ciaranlp avatar Nov 21 '17 15:11 ciaranlp

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.

oliverfoster avatar Nov 21 '17 17:11 oliverfoster

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.

tomgreenfield avatar Nov 21 '17 17:11 tomgreenfield

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.

oliverfoster avatar Nov 24 '17 11:11 oliverfoster

any thoughts on this @ciaranlp ?

oliverfoster avatar Dec 13 '17 10:12 oliverfoster

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

ciaranlp avatar Dec 13 '17 11:12 ciaranlp

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

oliverfoster avatar Dec 13 '17 12:12 oliverfoster

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

oliverfoster avatar Dec 13 '17 12:12 oliverfoster

@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.

oliverfoster avatar Jan 22 '18 15:01 oliverfoster

Yes @oliverfoster will do

ciaranlp avatar Jan 24 '18 10:01 ciaranlp

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 avatar Jan 24 '18 11:01 oliverfoster

@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

nilslp avatar Jan 25 '18 10:01 nilslp

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

oliverfoster avatar Jan 25 '18 11:01 oliverfoster

@nilslp can you approve the pr? > https://github.com/adaptlearning/adapt_framework/pull/1932

oliverfoster avatar Jan 25 '18 12:01 oliverfoster