Home General Discussion

CSS Redirect Issue

Matt_Howard1Matt_Howard1 Customer Adept IT Monkey ✭✭

Anyone seen where the custom.css redirects to custom.min.css? I'm trying to apply a change related to customizing Create on Behalf Of (https://community.cireson.com/discussion/1898/create-request-on-behalf-of-radio-buttons-and-text-change). The JS changes appear fine, but adding the CSS attribute never loads, presumably because of the 301.

I cannot find where this redirect occurs in any of the code, using the developer tools in browser, etc.

Best Answer

  • Matt_Howard1Matt_Howard1 Customer Adept IT Monkey ✭✭
    Answer ✓

    So...I found the answer. There is an IIS redirect specifically to the custom.min.css file. My predecessor had used a RequireJS optimization script to take all the includes and code in the custom.css to produce the minified file for better load time. Not the "official" way to update custom.css, but an interesting solution. I found the whole process if anyone would like to see it.

Answers

  • Matt_Howard1Matt_Howard1 Customer Adept IT Monkey ✭✭
    Answer ✓

    So...I found the answer. There is an IIS redirect specifically to the custom.min.css file. My predecessor had used a RequireJS optimization script to take all the includes and code in the custom.css to produce the minified file for better load time. Not the "official" way to update custom.css, but an interesting solution. I found the whole process if anyone would like to see it.

  • Shane_WhiteShane_White Cireson Support Super IT Monkey ✭✭✭✭✭

    Hi @Matt_Howard1

    I am actually interested in this if you don't mind sharing!!

    Thanks,

    Shane

  • Matt_Howard1Matt_Howard1 Customer Adept IT Monkey ✭✭
    edited May 2021

    Again, not taking credit for this solution, but posting it here for everyone (and @Shane_White)


    RequireJS Optimizer documentation


    You don't have to follow the structure listed in the article. For each file (JS or CSS), you need to create the build.js file. For example: custom.css has build-customCSS.js. Inside that build.js, is the directory path for the original file and the output file (custom.min.css)

    ({
      baseUrl: '../',
      cssIn: '../custom.css',
      out: '../custom.min.css',
      findNestedDependencies: true,
      optimizeCss: 'default',
      generateSourceMaps: true,
      preserveLicenseComments: false,
    })
    

    All of the build files are in a 'build' directory at the root of CustomSpace (there are more files including some of the JS files). You then create a master build script in your flavor of choice (build.bat in our case). Each file has it's own call to node and the r.js script:

    node r.js -o build-customCSS.js
    

    IIS Redirect

    1. In IIS Manager, expand the CiresonPortal site
    2. Right-click on the CustomSpace folder and select 'Switch to content view'
    3. Open HTTP Redirect
    4. Set the redirect path to '/CustomSpace/custom.min.css'
    5. Check the 'Only redirect requests to content in this directory...' and set the status code to 301 (Permanent)
    6. Repeat for each file you want to redirect to the optimized/minimized file.
    7. Right-click on the desired file to redirect (in this example, custom.css) and select 'Switch to feature view'. This will bring up all the usual IIS settings, but for the specific file.
Sign In or Register to comment.