SASS:使下划线文件名实际上创建css文件

时间:2021-03-19 09:46:06

By default SASS looks at the filename and determines whether to make a css file out of it. I'm wondering if there is a way to prevent this from happening.

默认情况下,SASS查看文件名并确定是否从中生成css文件。我想知道是否有办法防止这种情况发生。

We're building a large website and lots of front-end developers are editing the css, but we only have one dev server. Sure some things you can see happen locally, but often you can only see the real rendered way on the server.

我们正在构建一个大型网站,许多前端开发人员正在编辑css,但我们只有一个开发服务器。当然,您可以看到一些本地发生的事情,但通常您只能在服务器上看到真实的渲染方式。

So, when I push my compiled css file to the server, my co-workers' css gets clobbered until s/he commits and I do an svn:update, etc, etc.

因此,当我将编译后的css文件推送到服务器时,我的同事的css会受到破坏,直到他/她提交并执行svn:update等等。

However, if we were working in different SASS file, and those css files were getting created, I would only have to push up, say, the forms.css file instead of the whole thing.

但是,如果我们在不同的SASS文件中工作,并且那些css文件正在创建,我只需要推送,例如,forms.css文件而不是整个文件。

Then for Production, we'd put it back to the way SASS normally works.

然后对于Production,我们会把它恢复到SASS正常工作的方式。

The only other way I can figure to do this is to do a mass rename of files, which seem very messy.

我可以想到的另一种方法是对文件进行大规模重命名,这看起来非常混乱。

Thanks in advance.

提前致谢。

1 个解决方案

#1


7  

The entire point of partials is that they don't get compiled into files. If you want a sass file to be turned into a css file, remove the underscore.

部分的全部意义在于它们不会被编译成文件。如果要将sass文件转换为css文件,请删除下划线。

Your real problem seems the be that you're putting compiled CSS in your version control. Don't do that. Only commit Sass, and compile it into CSS server-side with a post-receive hook or something.

您真正的问题似乎是您正在将编译的CSS放入版本控制中。不要那样做。只提交Sass,并使用post-receive hook或其他东西将其编译到CSS服务器端。

#1


7  

The entire point of partials is that they don't get compiled into files. If you want a sass file to be turned into a css file, remove the underscore.

部分的全部意义在于它们不会被编译成文件。如果要将sass文件转换为css文件,请删除下划线。

Your real problem seems the be that you're putting compiled CSS in your version control. Don't do that. Only commit Sass, and compile it into CSS server-side with a post-receive hook or something.

您真正的问题似乎是您正在将编译的CSS放入版本控制中。不要那样做。只提交Sass,并使用post-receive hook或其他东西将其编译到CSS服务器端。