Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8606365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:04:39+00:00 2026-06-12T03:04:39+00:00

I’m using adapt.js for the first time on a project. I have a range

  • 0

I’m using adapt.js for the first time on a project. I have a range 0 to 720, I want to load a mobile.css file as well as a second css file, we’ll call it style.css. Is this possible? Are there any work arounds? I tried this but it didn’t work, as expected.

var ADAPT_CONFIG = {
    path: 'css/',

    dynamic: true,

    range: [
        '0px    to 720px  = style.css',
        '0px    to 720px  = mobile.css',
        '720px            = 720.css'
    ]
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:04:39+00:00Added an answer on June 12, 2026 at 3:04 am

    I’m afraid that this is impossible, but if you’re feeling daring you could probably modify the source of adapt.js to do this. Here’s the critical part of adapt.js:

    // If it's a range, split left/right sides of "to",
    // and then convert each one into numerical values.
    // If it's not a range, turn maximum into a number.
    val_1 = is_range ? parseInt(arr_0.split('to')[0], 10) : parseInt(arr_0, 10);
    val_2 = is_range ? parseInt(arr_0.split('to')[1], 10) : undefined;
    
    // Check for maxiumum or range.
    if ((!val_2 && i === last && width > val_1) || (width > val_1 && width <= val_2)) {
        // Build full URL to CSS file.
        file && (url = path + file);
    
        // Exit the while loop. No need to continue
        // if we've already found a matching range.
        break;
    }
    

    which is inside a while loop that checks the range conditions you specify in ADAPT_CONFIG. As you can see, once a path has been found, “range” ceases to be checked for any additional matches. You could probably change the code to allow it though – you’d probably have to move the code following the while loop into the above if statement and remove the break (this is an educated guess, I have not attempted this).

    However, depending on how you’re serving the files, I would strongly consider looking into an asset manager to combine “style.css” and “mobile.css” into a single file – precompiling assets allows for a few other fun tricks, like automatically making the css files as small as possible.

    EDIT – if you’re interested in an asset manager, there’s really no one way to do it; it will depend heavily on the environment you’re using at work. For something like rails this is super easy since merging files is fairly cooked in, and the sprockets gem has plenty of other features for asset management (combining files in it is pretty fast). If I were you though I’d probably just do some quick googling along the lines of “combining css files with “, there will be plenty of options. PHP scripts for this are all over the place if you don’t have a fancy framework (here’s a promising example), and Google makes an Apache mod for this kind of wok.

    If you do go this route, I’d encourage you to play around a bit once you get the basics working – you could do something nifty like generate the values for range in ADAPT_CONFIG in the same place as where you combine the files, giving you a nice clean, single point from where you can manage style files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I have a reasonable size flat file database of text documents mostly saved in
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.