Coder Social home page Coder Social logo

Comments (3)

chrissy-dev avatar chrissy-dev commented on August 16, 2024 1

Hey @ineptian, the issue is with html-minifier and it's dependency of clean-css to handle minifying CSS within <style> tags during HTML compression. This is noted as the culprit here. Clean CSS does actually support this in newer versions but the version html-minifier includes is a few years old and doesn't look likely to be updated any time soon.

There's a few options. Firstly, we want to stop html-minifier touching our CSS.

  1. On line 11 in ./utils/transforms.js set the minifyCSS option to false or remove it completely.

If you run a build, everything should now work as expected but the inline CSS won't be minified.

Switch to cssnano for minifying

  1. Install cssnano as a dependency
npm install cssnano --save-dev
  1. Update ./postcss.config.js to inline CSS in production
const isProduction = process.env.NODE_ENV === 'production';

module.exports = {
    plugins: [
        require('postcss-import'),
        require('tailwindcss'),
        require('autoprefixer'),
        isProduction && require('cssnano')({
            preset: 'default',
        }),
    ]
}

Hope this helps.

from eleventy-web-starter.

ineptian avatar ineptian commented on August 16, 2024 1

@chrissy-dev thanks so much for being so on it with the replies. I installed css nano and that worked great but I actually haven't tested the filters yet since I already migrated away from using them in the meantime. I have been wanting to test this though and will report back when I have time. You can keep closed for now.

from eleventy-web-starter.

chrissy-dev avatar chrissy-dev commented on August 16, 2024

@ineptian Closing this but feel free to comment on it to pick it up again 😊

from eleventy-web-starter.

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.