Code Monkey home page Code Monkey logo

Comments (6)

addyosmani avatar addyosmani commented on July 20, 2024

I'll take a look into this. It should be something we can show in the demo at least.

from grunt-uncss.

vertti avatar vertti commented on July 20, 2024

Run into this also, with default yeoman angularjs setup the cssmin uses:

    <!-- build:css({.tmp,app}) styles/main.css -->
    <link rel="stylesheet" href="styles/main.css">
    <!-- endbuild -->

and then uncss complains:

Running "uncss:dist" (uncss) task
Error: could not find: app/styles/main.css

althought it should be searching the .tmp directory instead.

from grunt-uncss.

ain avatar ain commented on July 20, 2024

+1

from grunt-uncss.

kuus avatar kuus commented on July 20, 2024

@vertti or if anybody have still trouble with this, you can use this setup in your Gruntfile.js to make uncss play nice with yeoman without even changing the index.html

    // Remove unused css
    uncss: {
      dist: {
        files: [{
      src: ['<%= yeoman.app %>/*.html', '<%= yeoman.app %>/views/{,*/}*.html'],
      dest: '.tmp/concat/styles/main.css'
        }]
      },
      options: {
        csspath: '../.tmp/concat/'
      }
    }

and then in the build task run uncss just before thee cssmin task:

    grunt.registerTask('build', [
      'clean:dist',
      'bower-install',
      'useminPrepare',
      'concurrent:dist',
      'autoprefixer',
      'concat',
      'ngmin',
      'copy:dist',
      'cdnify',
      'uncss', // here you are
      'cssmin',
      'uglify',
      'rev',
      'usemin',
      'htmlmin'
  ]);

you can leave the index.html as it is:

     <!-- build:css({.tmp,app}) styles/main.css -->

from grunt-uncss.

seriema avatar seriema commented on July 20, 2024

The problem I have with that approach is that usemin does slightly the same thing as uncss. It parses my index.html and generates a new CSS file. So running usemin after uncss overwrites the file uncss created.

rev makes this complicated too, as you can't run uncss after it (because of unknown rev'ed filenames) but you need to run usemin after rev. And running uncss after usemin results in a non-minified CSS.

from grunt-uncss.

trask avatar trask commented on July 20, 2024

@kuus +1 thanks!

from grunt-uncss.

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.