Problem with Grunt-uncss

Asked

Viewed 166 times

2

I wonder if it is possible to read a file . CSHTML with Grunt-uncss, because I searched and tried and so far had no results..

  • Why are you using a Node package in an ASP.NET MVC application?

  • To improve the speed of my site by removing redundancy and unnecessary css from bootstrap

  • Well, the chance of something like this working is minimal. From what I understand from reading the package, it reads only HTML.

  • I discovered that it is CSHTML, but I want you to read dynamically, along with my localhost, for example: http://localhost:50514/Home the documentation is here https://github.com/addyosmani/grunt-uncss#start-of-content

1 answer

1


In accordance with this comment on Github I managed to solve my problem the code was like this:

module.exports = function (grunt) {
    grunt.initConfig({
        uncss: {
            dist: {
                files: {
                    'Content/home.css': ['index.html']
                },
                options: {
                    urls: ['MinhaPagina/Home']
                }
            }
        }
    });

    // Load the plugins
    grunt.loadNpmTasks('grunt-uncss');

    // Default tasks.
    grunt.registerTask('uncss', ['uncss']);
};

EDIT: There needs to be a arquivo.html empty, which in my case is the index.html for the operation

Browser other questions tagged

You are not signed in. Login or sign up in order to post.