Git Product home page Git Product logo

Comments (4)

mischnic avatar mischnic commented on June 9, 2024

all the smart lightningcss defaults

Something is providing a default browserslist target list to Lightning CSS, so it really depends on how you're running Lightning CSS (as part of another build tool?)

Once you know that current value, you can just add your Safari range to it.

So it might just be that your browserslist config should be defaults, Safari >= 14

from lightningcss.

etsystoyan avatar etsystoyan commented on June 9, 2024

I'm running it standalone from the CLI (and as a node library), so for example this is the default:

lightningcss --minify --error-recovery before.css -o after.css

then

lightningcss --minify --targets 'defaults' --error-recovery before.css -o after.css

... gives me a different output than no targets at all

One difference I see is when I specify a Safari >= 14 target a lot of old -webkit- prefixes are stripped. And these are kept when no target is given (LightningCSS defaults). I think this is cool, but makes me slightly nervous that default LightningCSS keeps them. Even though LightningCSS seems to assume a newer Safari by default (e.g. using inset property which is not in Safari 14)

Once you know that current value, you can just add your Safari range to it.

My plan exactly, except I cannot figure out that current value

from lightningcss.

mischnic avatar mischnic commented on June 9, 2024

Strange, it should by default use defaults in that case according to this comment:

/// Finds browserslist configuration, selects queries by environment and loads the resulting queries into LightningCSS targets.
///
/// Configuration resolution is modeled after the original `browserslist` nodeJS package.
/// The configuration is resolved in the following order:
///
/// - If a `BROWSERSLIST` environment variable is present, then load targets from its value. This is analog to the `--targets` CLI option.
/// Example: `BROWSERSLIST="firefox ESR" lightningcss [OPTIONS] <INPUT_FILE>`
/// - If a `BROWSERSLIST_CONFIG` environment variable is present, then resolve the file at the provided path.
/// Then parse and use targets from `package.json` or any browserslist configuration file pointed to by the environment variable.
/// Example: `BROWSERSLIST_CONFIG="../config/browserslist" lightningcss [OPTIONS] <INPUT_FILE>`
/// - If none of the above apply, then find, parse and use targets from the first `browserslist`, `.browserslistrc`
/// or `package.json` configuration file in any parent directory.
///
/// When using parsed configuration from `browserslist`, `.browserslistrc` or `package.json` configuration files,
/// the environment determined by:
///
/// - the `BROWSERSLIST_ENV` environment variable if present,
/// - otherwise the `NODE_ENV` environment varialbe if present,
/// - otherwise `production` is used.
///
/// If no targets are found for the resulting environment, then the `defaults` configuration section is used.

from lightningcss.

etsystoyan avatar etsystoyan commented on June 9, 2024

Interesting, I thought it's last 10 browser versions and further tweaking, happening during build time:

const latestBrowserVersions = {};
for (let b in browsers) {
let versions = browsers[b].versions.slice(-10);
for (let i = versions.length - 1; i >= 0; i--) {
if (versions[i] != null && versions[i] != "all" && versions[i] != "TP") {
latestBrowserVersions[b] = versions[i];
break;
}
}
}

from lightningcss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.