加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – 生成源映射时出错 – grunt和sass配置

发布时间:2020-12-17 02:07:15 所属栏目:百科 来源:网络整理
导读:我试图用咕噜声来使用sass.我在路上安装了 ruby,sass和grunt. 版本是, node: 0.10.20 npm: 1.3.11 grunt-cli: 0.1.13 grunt: 0.4.5 sass: 3.4.4 我的包json是, "private": true,"devDependencies": { "express": "4.x","grunt": "~0.4.1","grunt-contrib-sas
我试图用咕噜声来使用sass.我在路上安装了 ruby,sass和grunt.
版本是,

node: 0.10.20
npm: 1.3.11
grunt-cli: 0.1.13
grunt: 0.4.5
sass: 3.4.4

我的包json是,

"private": true,"devDependencies": {
    "express": "4.x","grunt": "~0.4.1","grunt-contrib-sass": "~0.3.0","grunt-contrib-watch": "~0.4.4" 
}

我的grunt文件是,

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),sass: {
            dist: {
                files: {
                    'style/style.css' : 'sass/home.scss'
                }
            }
        },watch: {
            css: {
                files: '**/*.scss',tasks: ['sass']
            }
        }
    });
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.registerTask('default',['watch']);
}

现在,如果我尝试“grunt”命令,我收到以下错误.有帮助吗?

run:grunt或grunt watch或grunt sass

错误:

Running "sass:dist" (sass) task
Error: Error generating source map: couldn't determine public URL for the source
 stylesheet.
         No filename is available so there's nothing for the source map to link
to.
        on line  of standard input
  Use --trace for backtrace.
Warning: Error: Error generating source map: couldn't determine public URL for t
he source stylesheet.
         No filename is available so there's nothing for the source map to link
to.
        on line  of standard input
  Use --trace for backtrace. Use --force to continue.

Aborted due to warnings.

任何的想法?

解决方法

看起来你没有安装指南针.你可以运行gem install compass.在您的原始示例中,您已将grunt文件设置为使用指南针,这将使您可以访问指南针混合和功能.

你的代码现在看起来很好,应该可以工作,但似乎找不到你的文件.当我在电脑旁边的时候,我也会接受它.

在此期间,您可以在sass任务上尝试sourcemap:none选项.

更新:

对我来说效果很好.您可以运行树-I node_modules并发布输出(除非您认为有任何敏感信息)只是为了仔细检查文件是否在正确的位置?

我希望它看起来像这样

.
├── Gruntfile.js
├── package.json
├── sass
│?? └── style.scss
└── style
    ├── style.css
    └── style.css.map

第二次更新:
您的软件包看起来比我新设置的软件包要早得多.尝试从头开始或执行以下操作:

安装npm-check-updates

npm install npm-check-updates

然后运行以下命令

> npm-check-updates将告诉您哪些包已过时> npm-check-updates -u将更新package.json中的那些包> npm update更新所有过时的软件包.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读