简体   繁体   English

如何通过scss文件编辑css

[英]How to edit css through scss files

Actually for a recent project i downloaded a theme (Admin Panel).实际上,对于最近的一个项目,我下载了一个主题(管理面板)。 It mostly contains css in parts in the form of .scss files .它主要包含.scss文件形式的部分css I tried editing files directly from style.css but nothing seems to change .我尝试直接从style.css编辑文件,但似乎没有任何改变。 so i did little bit of research and found that scss files need to compiled again .所以我做了一点研究,发现scss文件需要再次编译。 I don't know how to compile .scss files.我不知道如何编译.scss文件。 On their github page i found that it can be changed with the help of following commands在他们的 github 页面上,我发现可以在以下命令的帮助下进行更改

gulp serve

I don't know the above command was to compile again scss into css but it didn't work So ,kindly help with this or just a provide a link to the tutorial from where i could learn this我不知道上面的命令是将 scss 再次编译为 css,但它不起作用所以,请帮忙解决这个问题,或者只是提供一个指向教程的链接,我可以从那里学习这个

Here's the link for the project that i have just downloaded https://github.com/BootstrapDash/PurpleAdmin-Free-Admin-Template这是我刚刚下载的项目的链接https://github.com/BootstrapDash/PurpleAdmin-Free-Admin-Template

Thanks in Advance提前致谢

Setting up a SCSS compiler for a project where you don't use SCSS yourself is tedious.为一个你自己不使用 SCSS 的项目设置一个 SCSS 编译器是很乏味的。 Instead, try compiling it quickly and edit the CSS files after you compiled it.相反,尝试快速编译它并在编译后编辑 CSS 文件。

You can use free compilers online, for example https://www.cssportal.com/scss-to-css/ .您可以在线使用免费的编译器,例如https://www.cssportal.com/scss-to-css/

If you would like to start a project with SCSS where you compile it, you can indeed use the GULP setup provided by Bootstrap.如果您想使用 SCSS 启动一个项目,并在其中编译它,您确实可以使用 Bootstrap 提供的 GULP 设置。

https://mdbootstrap.com/bootstrap-gulp-tutorial/ https://mdbootstrap.com/bootstrap-gulp-tutorial/

You can also easily setup Gulp yourself:你也可以自己轻松设置 Gulp:

https://codehangar.io/gulp-sass/ https://codehangar.io/gulp-sass/

The above URL explains the following a little more extensive:上面的 URL 对以下内容进行了更广泛的解释:

npm install gulp-sass --save-dev npm install gulp-sass --save-dev

Structure :结构:

-index.html
--assets
---styles
----sass
-----index.scss
----css

The 'styles' Task “风格”任务

//gulpfile.js

var gulp = require('gulp');
var sass = require('gulp-sass');

//style paths
var sassFiles = 'assets/styles/sass/**/*.scss',
    cssDest = 'assets/styles/css/';

gulp.task('styles', function(){
    gulp.src(sassFiles)
        .pipe(sass().on('error', sass.logError))
        .pipe(gulp.dest(cssDest));
});

Watcher守望者

gulp.task('watch',function() {
    gulp.watch(sassFiles,['styles']);
});

gulp watch吞咽手表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM