Sass :: SyntaxError:“......比率:2”和“:预期的媒体表达式后的无效CSS(例如(min-device-width:800px))

时间:2016-03-05 07:51:09

标签: ruby-on-rails sass

我在生产时资产预编译时遇到Sass错误。

rake aborted!
Sass::SyntaxError: Invalid CSS after "...-ratio: 2) and ": expected media expression (e.g. (min-device-width: 800px)), was "only screen and..."
(sass):17716
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:1179:in `expected'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:1115:in `expected'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:1095:in `expr!'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:454:in `media_query'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:412:in `media_query_list'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:1093:in `expr!'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:407:in `media_directive'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:220:in `special_directive'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:195:in `directive'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:673:in `block_child'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:666:in `block_contents'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:123:in `stylesheet'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/scss/parser.rb:39:in `parse'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/engine.rb:403:in `_to_tree'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sass-3.4.21/lib/sass/engine.rb:278:in `render'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/sass_compressor.rb:48:in `call'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/sass_compressor.rb:28:in `call'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/loader.rb:60:in `block in load'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/loader.rb:44:in `load'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `yield'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `load'
/usr/local/rvm/gems/ruby-2.2.1@echopractices/gems/sprockets-3.5.2/lib/sprockets/base.rb:66:in `find_asset'

代码:

/* ----------------------------------------------------------------
    Retina CSS
-----------------------------------------------------------------*/

@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (   min--moz-device-pixel-ratio: 2),
only screen and (     -o-min-device-pixel-ratio: 2/1),
only screen and (        min-device-pixel-ratio: 2),
only screen and (                min-resolution: 192dpi),
only screen and (                min-resolution: 2dppx) {

    #logo {
        a {
            &.standard-logo {
                display: none;
            }
            &.retina-logo {
                display: block;
            }
        }
    }

    .owl-carousel.owl-loading,
    .preloader,
    .preloader2,
    .form-process {
        background-image: image-url('preloader@2x.gif');
        background-size: 24px 24px;
    }

    .dark{
        .owl-carousel.owl-loading,
        .preloader,
        .preloader2,
        .form-process {
            background-image: image-url('preloader-dark@2x.gif');
        }

    }

    .widget_recent_comments {
        li {
            background-image: image-url("widget-comment@2x.png");
            background-size: 15px 26px;
        }
    }

    .widget_nav_menu,
    .widget_links,
    .widget_meta,
    .widget_archive,
    .widget_recent_entries,
    .widget_categories,
    .widget_pages,
    .widget_rss,
    .widget_recent_comments{
         li a {
            background-image: image-url("widget-link@2x.png");
            background-size: 4px 20px;
        }
    }

    .dark {
        .widget_recent_comments {
            li {
                background-image: image-url("widget-comment-dark@2x.png");
            }
        }
    }

    .dark {
        .widget_nav_menu,
        .widget_links,
        .widget_meta,
        .widget_archive,
        .widget_recent_entries,
        .widget_categories,
        .widget_pages,
        .widget_rss,
        .widget_recent_comments {
             li a {
                background-image: image-url("widget-link-dark@2x.png");
            }
        }

    }

    @media
    only screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 991px),
    only screen and (   min--moz-device-pixel-ratio: 2) and (max-width: 991px),
    only screen and (     -o-min-device-pixel-ratio: 2/1) and (max-width: 991px),
    only screen and (        min-device-pixel-ratio: 2) and (max-width: 991px),
    only screen and (                min-resolution: 192dpi) and (max-width: 991px),
    only screen and (                min-resolution: 2dppx) and (max-width: 991px) {
        #logo {
            a {
                &.standard-logo {
                    display: none;
                }
                &.retina-logo {
                    display: inline-block;
                }
            }
        }

    }

}

0 个答案:

没有答案