fs / static-base

A starter kit to help you develop static sites (or prototypes) faster. Middleman, Slim, Sass, CoffeeScript, Autoprefixer and Livereload.
http://www.flatstack.com/open-source/
4 stars 2 forks source link

Add tasks for unused css removal #33

Closed daniilsunyaev closed 10 years ago

daniilsunyaev commented 10 years ago

https://github.com/fs/static-base/issues/31

timurvafin commented 10 years ago

@antongudkov @daniilsunyaev what you think if we will use https://github.com/aanand/deadweight instead of Grunt task?

vast commented 10 years ago

:-1: on idea with grunt - "костыль"-like dependency.

:+1: on adding deadweight to build process

daniilsunyaev commented 10 years ago

@vast unfortunately deadweight uses nokogiri, which fails to parse our deafdult css files

vast commented 10 years ago

@daniilsunyaev, can we create Ruby wrapper/adapter for the uncss: https://github.com/giakki/uncss In that case we'll still have js-runtime dependency, but won't have to install and use grunt.

What do you think?

daniilsunyaev commented 10 years ago

Sounds ok, just... requires some time. Right now I have no idea how this can be made, so I have to perform a little investigation. Have to realize how everything works undercover.

vast commented 10 years ago

@daniilsunyaev, no worries. I guess, you can take a look, for example, at ruby-stylus for ideas on how to wrap js library in Ruby:

daniilsunyaev commented 10 years ago

@vast thanks for the link, I'll take a look as soon as I'll got some time

timurvafin commented 10 years ago

@daniilsunyaev could you please share errors from nokogiri?

daniilsunyaev commented 10 years ago

@timurvafin sure, here you go:

$ deadweight -s build/assets/stylesheets/*.css build/*.html
build/assets/stylesheets/application-3d25a045.css
  found 1491 selectors

build/404.html
  html
  body
  h1
  *
/home/das/.rvm/gems/ruby-2.1.0/gems/nokogiri-1.6.1/lib/nokogiri/css/parser_extras.rb:87:in `on_error': unexpected '"' after 'prefix_match' (Nokogiri::CSS::SyntaxError)

Line-by-line I've found that troubles are caused by this lines

a[href^="javascript:"]:after,
a[href^="#"]:after {
   content: "";
}

If we'll remove content: ""; no errors will riase during execution.

vast commented 10 years ago

closing since no action on this