1

I am new to grunt and using for the java-script and css magnification. It's just an awesome tool. After exploring the grunt few more i came across uncss module which can help a lot to improve the load time and size of the css (especially framework like bootstrap css ).

I have app in angular and php which has a classes generated by php and java-script dynamically .While running the uncss this css selector are removed from new css file generated.

I think i have install phantom-js while installing the uncss module of grunt.

Can anyone has idea how i can achieve this.

1
  • I don't think it will work for dynamic content generated by js, the walkaround may be save all the css manually. Check: github.com/giakki/uncss/issues/50. Hope that help. Commented Jun 14, 2014 at 10:24

1 Answer 1

2

If you know the selectors of the generated css you can use the ignore option:

uncss: {
  dist: {
    files: {
      'dist/css/app.css': ['app/index.html']
    }
  },
  options: {
    ignore: ['#ignoredselector', '.ignoredselector']
  }
}
Sign up to request clarification or add additional context in comments.

2 Comments

it worked for me using the url under options, but i need to go and put every url, how can i ignore putting url manually.
you can use *.php to select every .php file in the folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.