最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - SASS Output Style automate with minified file - Stack Overflow

programmeradmin6浏览0评论

I'm trying to do test to use correctly SASS and I want create a file style.css and that file minify to style.min.css

sass --watch sass/style:css --style pressed

That works well but I need automate proccess doing pile & minify at the same time.

I've found this code in other stackoverflow:

sass --watch sass/style.scss:css/style.css --watch css/style.css:css/style.min.css --style pressed --scss

but now dont work how I want that works. Also at Sass webpage the code is different now on 2020.

I'm not use gulp tool because I think it not neccesary for Wordpress projects.

Anybody may help me?

I'm trying to do test to use correctly SASS and I want create a file style.css and that file minify to style.min.css

sass --watch sass/style:css --style pressed

That works well but I need automate proccess doing pile & minify at the same time.

I've found this code in other stackoverflow:

sass --watch sass/style.scss:css/style.css --watch css/style.css:css/style.min.css --style pressed --scss

but now dont work how I want that works. Also at Sass webpage the code is different now on 2020.

https://sass-lang./documentation/cli/dart-sass#style

I'm not use gulp tool because I think it not neccesary for Wordpress projects.

Anybody may help me?

Share Improve this question edited Apr 27, 2020 at 14:33 Antonio Ángel Estrada Pérez asked Apr 27, 2020 at 11:51 Antonio Ángel Estrada PérezAntonio Ángel Estrada Pérez 1331 silver badge5 bronze badges 2
  • Use node-sass is faster than sass Usage is very simple node-sass ./style.scss ./style.min.css -w --output-style pressed – Grzegorz T. Commented Apr 27, 2020 at 12:09
  • That not works. node-sass: The term 'node-sass' is not recognized as the name of a cmdlet, function, script file or executable program. Correctly if you typed correctly the name or, if you included a path, verify that the path is correct and Try again. – Antonio Ángel Estrada Pérez Commented Apr 27, 2020 at 14:56
Add a ment  | 

1 Answer 1

Reset to default 8

Irrespective of what you're building your site in, if you want total control over pilation/minification/whatever then well, that's what tooling such as gulp is there for.

It looks like you were trying to pile SCSS to CSS to a file, then take that piled CSS file and minify it. That CLI tool won't do that, but it can absolutely do the pilation/pression at the same time, directly from the source SCSS.

Using the binary you're using, this is going to pile and press, taking ./sass/style.scss and outputting the result to ./css/style.min.css

sass sass/style.scss:css/style.min.css --style pressed

Add --watch if you want to have it react to file changes in your scss file.

Or perhaps you were trying to get a unminified and a minified version alongside. In that case, you'll simply have to run two mands. Again, gulp is there to automate this process.

Other binaries will have different flags and options, and of course there is the gulp option which I'd certainly remend given you then don't have to remember any lengthy mands and you can share your chosen structure/tasks accross projects.

发布评论

评论列表(0)

  1. 暂无评论