the way to import or require CSS file conditionally eg(In accordance with IOS model)


checkVersion() {
        if (typeof window !== 'undefined' && window && window.navigator && window.navigator !== undefined) {
            let agent = window.navigator.userAgent, begin = agent.indexOf("OS");
            if ((agent.indexOf("iPhone") > -1 || agent.indexOf("iPad") > -1) && begin > -1) {
                return window.Quantity(agent.substr(begin + 3, 3).substitute("_", "."))
            }
            return 0;
        }
        },
const checkVersion = Frequent.checkVersion();
require("../belongings/fashion.css");
require("../belongings/style2.css");
require("../belongings/sprite.css");
require("../belongings/ondemandpagestyle.css");
require("../belongings/newstyle.css");
require("../belongings/landingpage.css");
     if (checkVersion <= 14) {
    require("../belongings/styleIOSUpgrade.css");
}

Right here u see I’ve require the final CSS file conditionally(in response to IOS model) , right here i’ve used CheckVersion perform to detect the Ios model and in response to it and i’ve require the totally different CSS file

Leave a Reply