CSS @import语句 [英] CSS @import statement

查看:190
本文介绍了CSS @import语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用Initializr生成的Bootstrap增强版本的HTML5 Boilerplate,它也包括LESS框架。

I'm currently using the Initializr generated Bootstrap enhanced version of the HTML5 Boilerplate which also includes the LESS framework.

现在style.less被包含在

Now the style.less is being included by the following line:

<link rel="stylesheet/less" href="${resource(dir: 'less', file: 'style.less') }">

这行有效,但 @import('bootstrap / bootstrap.less ')失败,因为它在 /static/less/bootstrap/bootstrap.less中找不到 bootstrap.less 。但是,该文件没有 static 部分。

This works, but the line @import('bootstrap/bootstrap.less') fails, because it cannot find the bootstrap.less file in /static/less/bootstrap/bootstrap.less. However, the file is available without the static part.

有什么我需要告诉Grails把不是直接在一个GSP页面中引用的文件(它们可能是什么类型)在正确的目录,即 static

Is there something I need to tell Grails to put the not directly in a GSP page referenced files (what kind they may be of) in the right directory, i.e. static?

我发现有关此问题的问题: http://jira.grails.org/browse/GPRESOURCES -135 - 这告诉我,它已经在1.2版本中修复,我目前使用2.0.2。

I found an issue regarding this problem: http://jira.grails.org/browse/GPRESOURCES-135 - this is telling me, that it has been fixed in version 1.2, I am currently using 2.0.2.

我需要做什么

推荐答案

我安装了 lesscss-resources plugin预编译 LESS 文件。这样,我也可以使用 @import 语句。

I installed the lesscss-resources plugin which precompiles LESS files. This way, I can also use the @import statements.

我已经将我的核心样式表定义为模块 ApplicationConfig.groovy

I have defined my core stylesheets as a module in ApplicationConfig.groovy.

modules = {

    // ...

    sitecore {      
        dependsOn 'jquery'

        resource url:'less/style.less', attrs:[rel: "stylesheet/less", type:'css'], bundle:'bundle_sitecore'
        resource url:'js/main.js'
    }

通过这样做,我可以使用Grails的Resources插件来引用它:

And by doing so, I can just reference it using the Resources plugin of Grails:

<r:require module="sitecore" />

这篇关于CSS @import语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆