{"id":172651,"date":"2024-05-08T17:54:51","date_gmt":"2024-05-08T09:54:51","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/172651.html"},"modified":"2024-05-08T17:54:57","modified_gmt":"2024-05-08T09:54:57","slug":"%e8%af%b7%e9%97%aesass%e6%a0%b7%e5%bc%8f%e9%a2%84%e5%a4%84%e7%90%86%e7%9a%84%e5%bf%85%e8%a6%81%e8%bd%af%e4%bb%b6ruby%e6%98%af%e5%81%9a%e4%bb%80%e4%b9%88%e7%94%a8%e7%9a%84","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/172651.html","title":{"rendered":"\u8bf7\u95eesass\u6837\u5f0f\u9884\u5904\u7406\u7684\u5fc5\u8981\u8f6f\u4ef6Ruby\u662f\u505a\u4ec0\u4e48\u7528\u7684"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27044301\/210dc1fe-a0da-453d-b3ce-6e6ef0606958.webp\" alt=\"\u8bf7\u95eesass\u6837\u5f0f\u9884\u5904\u7406\u7684\u5fc5\u8981\u8f6f\u4ef6Ruby\u662f\u505a\u4ec0\u4e48\u7528\u7684\" \/><\/p>\n<p><p><strong>Sass\uff08Syntactically Awesome Stylesheets\uff09\u6837\u5f0f\u9884\u5904\u7406\u5668\u7684\u5fc5\u8981\u8f6f\u4ef6Ruby<\/strong>\u4e3b\u8981\u662f\u7528\u4e8e<strong>\u5b89\u88c5Sass<\/strong>\u3001<strong>\u7f16\u8bd1Sass\/SCSS\u4e3aCSS\u4ee3\u7801<\/strong>\u3001\u4ee5\u53ca<strong>\u7ba1\u7406Sass\u5e93\u548c\u63d2\u4ef6<\/strong>\u3002\u5176\u4e2d\uff0c<strong>\u7f16\u8bd1Sass\/SCSS\u4e3aCSS\u4ee3\u7801<\/strong>\u662f\u5176\u6700\u6838\u5fc3\u7684\u529f\u80fd\uff0c\u56e0\u4e3aSass\u6216SCSS\u672c\u8eab\u5e76\u4e0d\u80fd\u88ab\u6d4f\u89c8\u5668\u76f4\u63a5\u8bc6\u522b\uff0c\u9700\u901a\u8fc7\u7f16\u8bd1\u8f6c\u6362\u4e3aCSS\u4ee3\u7801\uff0c\u800cRuby\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5e73\u53f0\u8ba9\u8fd9\u4e00\u8fc7\u7a0b\u53d8\u5f97\u7b80\u6613\u548c\u9ad8\u6548\u3002\u968f\u7740\u5f00\u53d1\u793e\u533a\u7684\u53d1\u5c55\uff0cSass\u7684\u5b89\u88c5\u548c\u4f7f\u7528\u4e5f\u9010\u6e10\u4e0d\u518d\u4f9d\u8d56\u4e8eRuby\u73af\u5883\uff0c\u51fa\u73b0\u4e86\u591a\u79cd\u57fa\u4e8eNode.js\u7684\u5b9e\u73b0\u65b9\u5f0f\uff0c\u5982\u4f7f\u7528Node-sass\u6216Dart Sass\u7b49\uff0c\u8fd9\u4e9b\u65b9\u5f0f\u63d0\u4f9b\u4e86\u66f4\u591a\u6837\u5316\u548c\u9ad8\u6548\u7684\u9009\u9879\u3002<\/p>\n<\/p>\n<p><h3><strong>\u4e00\u3001SASS\u7f16\u8bd1\u5de5\u5177\u7684\u5b89\u88c5\u4e0e\u4f7f\u7528<\/strong><\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u4f7f\u7528Sass\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u5bf9\u5e94\u7684\u7f16\u8bd1\u5de5\u5177\u3002Ruby\u66fe\u7ecf\u662f\u5b89\u88c5\u548c\u8fd0\u884cSass\u7684\u4e3b\u6d41\u65b9\u5f0f\uff0c\u7528\u6237\u9700\u5148\u5b89\u88c5Ruby\uff0c\u7136\u540e\u901a\u8fc7RubyGems\uff08Ruby\u7684\u5305\u7ba1\u7406\u5668\uff09\u5b89\u88c5Sass\u3002\u5b89\u88c5Ruby\u7684\u8fc7\u7a0b\u76f8\u5bf9\u7b80\u5355\uff0c\u5728\u5b98\u7f51\u4e0b\u8f7d\u9002\u5408\u81ea\u5df1\u64cd\u4f5c\u7cfb\u7edf\u7684\u7248\u672c\uff0c\u4e00\u8def\u70b9\u51fb\u5b89\u88c5\u5373\u53ef\u3002\u5b89\u88c5\u5b8cRuby\u540e\uff0c\u53ef\u901a\u8fc7\u547d\u4ee4\u884c\u5b89\u88c5Sass\u3002<\/p>\n<\/p>\n<p><p>\u7136\u800c\uff0c\u968f\u7740\u6280\u672f\u7684\u8fdb\u6b65\uff0c\u73b0\u5728\u6709\u4e86\u66f4\u591a\u9009\u62e9\uff0c\u6bd4\u5982\u57fa\u4e8eNode.js\u7684\u5b9e\u73b0\u65b9\u5f0f\u2014\u2014Node-sass\u6216Dart Sass\u3002\u8fd9\u4e24\u8005\u4e3a\u7528\u6237\u63d0\u4f9b\u4e86\u66f4\u4e3a\u4fbf\u6377\u548c\u9ad8\u6548\u7684\u5b89\u88c5\u53ca\u4f7f\u7528\u65b9\u6cd5\uff0c\u5c24\u5176\u662fDart Sass\u4f5c\u4e3a\u5b98\u65b9\u63a8\u8350\u7684\u5b9e\u73b0\uff0c\u5176\u6027\u80fd\u548c\u517c\u5bb9\u6027\u90fd\u5f97\u5230\u4e86\u663e\u8457\u63d0\u5347\u3002<\/p>\n<\/p>\n<p><h3><strong>\u4e8c\u3001SASS\u7f16\u8bd1\u8fc7\u7a0b\u8be6\u89e3<\/strong><\/h3>\n<\/p>\n<p><p>Sass\u7684\u7f16\u8bd1\u8fc7\u7a0b\u662f\u5c06Sass\u6216SCSS\u6587\u4ef6\u8f6c\u6362\u6210\u6d4f\u89c8\u5668\u53ef\u8bc6\u522b\u7684CSS\u6587\u4ef6\u3002\u5728Ruby\u73af\u5883\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177\u8fdb\u884c\u7f16\u8bd1\uff0c\u5177\u4f53\u547d\u4ee4\u5982<code>sass input.scss output.css<\/code>\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u7528\u6237\u53ef\u4ee5\u9009\u62e9\u4e0d\u540c\u7684\u8f93\u51fa\u98ce\u683c\uff0c\u5982\u538b\u7f29\u7684\u3001\u5c55\u5f00\u7684\u7b49\uff0c\u4ee5\u6ee1\u8db3\u4e0d\u540c\u573a\u666f\u7684\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><p>\u6b64\u5916\uff0c\u4e3a\u4e86\u589e\u52a0\u5f00\u53d1\u6548\u7387\uff0cSass\u63d0\u4f9b\u4e86\u76d1\u542c\u529f\u80fd\uff0c\u5373\u901a\u8fc7<code>--watch<\/code>\u53c2\u6570\u53ef\u4ee5\u8ba9Sass\u76d1\u542c\u6587\u4ef6\u7684\u53d8\u5316\uff0c\u5e76\u81ea\u52a8\u7f16\u8bd1\u3002\u8fd9\u5927\u5927\u51cf\u5c11\u4e86\u624b\u52a8\u7f16\u8bd1\u7684\u7e41\u7410\uff0c\u4f7f\u5f97\u5f00\u53d1\u8005\u53ef\u4ee5\u66f4\u4e13\u6ce8\u4e8e\u4ee3\u7801\u7684\u7f16\u5199\u3002<\/p>\n<\/p>\n<p><h3><strong>\u4e09\u3001SASS\u5e93\u548c\u63d2\u4ef6\u7684\u7ba1\u7406<\/strong><\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u57fa\u7840\u7684\u7f16\u8bd1\u529f\u80fd\u5916\uff0cRuby\u8fd8\u4e3aSass\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5e93\u548c\u63d2\u4ef6\u7ba1\u7406\u529f\u80fd\u3002\u8fd9\u4e9b\u5e93\u548c\u63d2\u4ef6\u6781\u5927\u5730\u6269\u5c55\u4e86Sass\u7684\u80fd\u529b\uff0c\u4f7f\u5176\u4e0d\u4ec5\u4ec5\u662f\u4e00\u4e2a\u6837\u5f0f\u9884\u5904\u7406\u5668\uff0c\u66f4\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\u96c6\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7RubyGems\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u8f7b\u677e\u5b89\u88c5\u548c\u7ba1\u7406\u8fd9\u4e9b\u5e93\u548c\u63d2\u4ef6\u3002\u5982Compass\u662f\u4e00\u4e2a\u975e\u5e38\u8457\u540d\u7684Sass\u6846\u67b6\uff0c\u901a\u8fc7\u5b83\u53ef\u4ee5\u4f7f\u7528\u66f4\u591a\u9ad8\u7ea7\u529f\u80fd\u548c\u6df7\u5408\u5b8f\uff08Mixins\uff09\uff0c\u4fc3\u4f7f\u5f00\u53d1\u8005\u7684\u5de5\u4f5c\u66f4\u52a0\u9ad8\u6548\u3002<\/p>\n<\/p>\n<p><h3><strong>\u56db\u3001SASS\u4e0e\u73b0\u4ee3\u5f00\u53d1\u5de5\u4f5c\u6d41\u7684\u878d\u5408<\/strong><\/h3>\n<\/p>\n<p><p>\u5728\u73b0\u4ee3Web\u5f00\u53d1\u4e2d\uff0c\u9884\u5904\u7406\u5668\u5df2\u7ecf\u6210\u4e3a\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u90e8\u5206\uff0c\u800c\u5982\u4f55\u5c06Sass\u878d\u5165\u5230\u6574\u4e2a\u5f00\u53d1\u5de5\u4f5c\u6d41\u4e2d\u4e5f\u6210\u4e3a\u4e86\u5f00\u53d1\u8005\u9700\u8981\u8003\u8651\u7684\u95ee\u9898\u3002\u968f\u7740\u6784\u5efa\u5de5\u5177\u5982Webpack\u3001Gulp\u7684\u6d41\u884c\uff0cSass\u7684\u7f16\u8bd1\u73af\u8282\u53ef\u4ee5\u4e0e\u5176\u4ed6\u4efb\u52a1\uff08\u5982\u81ea\u52a8\u5237\u65b0\u6d4f\u89c8\u5668\u3001\u538b\u7f29\u56fe\u7247\u7b49\uff09\u4e00\u8d77\u6574\u5408\uff0c\u5f62\u6210\u4e00\u5957\u5b8c\u6574\u7684\u81ea\u52a8\u5316\u4efb\u52a1\u94fe\u3002<\/p>\n<\/p>\n<p><p>\u8fd9\u79cd\u5de5\u4f5c\u6d41\u7684\u597d\u5904\u5728\u4e8e\uff0c\u5b83\u53ef\u4ee5\u6700\u5c0f\u5316\u91cd\u590d\u52b3\u52a8\uff0c\u4f7f\u5f97\u5f00\u53d1\u8fc7\u7a0b\u66f4\u52a0\u6d41\u7545\u3002\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u81ea\u5b9a\u4e49\u4efb\u52a1\uff0c\u6839\u636e\u9879\u76ee\u9700\u6c42\u8fdb\u884c\u9ad8\u5ea6\u7684\u4e2a\u6027\u5316\u8bbe\u7f6e\u3002<\/p>\n<\/p>\n<p><h3><strong>\u4e94\u3001\u7ed3\u8bba<\/strong><\/h3>\n<\/p>\n<p><p>\u867d\u7136Ruby\u5728Sass\u7684\u65e9\u671f\u626e\u6f14\u4e86\u91cd\u8981\u89d2\u8272\uff0c\u63d0\u4f9b\u4e86\u5b89\u88c5\u3001\u7f16\u8bd1\u3001\u7ba1\u7406\u5e93\u548c\u63d2\u4ef6\u7684\u529f\u80fd\uff0c\u4f46\u968f\u7740\u6280\u672f\u7684\u53d1\u5c55\uff0c\u5982\u4eca\u5f00\u53d1\u8005\u62e5\u6709\u4e86\u66f4\u591a\u9009\u62e9\u3002Node.js\u7b49\u6280\u672f\u7684\u5174\u8d77\u4f7f\u5f97Sass\u7684\u5b89\u88c5\u548c\u4f7f\u7528\u66f4\u52a0\u591a\u6837\u5316\u548c\u65b9\u4fbf\u3002<strong>\u65e0\u8bba\u9009\u62e9\u54ea\u79cd\u65b9\u5f0f\uff0c\u5173\u952e\u5728\u4e8e\u5145\u5206\u5229\u7528Sass\u5e26\u6765\u7684\u4fbf\u5229\uff0c\u63d0\u9ad8CSS\u7684\u7f16\u5199\u6548\u7387\u548c\u8d28\u91cf\uff0c\u4ece\u800c\u52a0\u901f\u5f00\u53d1\u6d41\u7a0b\uff0c\u63d0\u5347\u6700\u7ec8\u4ea7\u54c1\u7684\u54c1\u8d28\u3002<\/strong><\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. Ruby\u662fsass\u6837\u5f0f\u9884\u5904\u7406\u4e2d\u7684\u6838\u5fc3\u4f9d\u8d56\uff0c\u5b83\u7684\u4f5c\u7528\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\nRuby\u5728sass\u6837\u5f0f\u9884\u5904\u7406\u4e2d\u8d77\u7740\u975e\u5e38\u91cd\u8981\u7684\u4f5c\u7528\uff0c\u5b83\u662f\u4e00\u79cd\u5f3a\u5927\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u7528\u4e8e\u5904\u7406\u548c\u89e3\u6790sass\u6587\u4ef6\u3002Ruby\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5b8c\u6574\u7684\u5f00\u53d1\u73af\u5883\u548c\u8fd0\u884c\u65f6\u73af\u5883\uff0c\u4f7f\u5f97\u5f00\u53d1\u8005\u53ef\u4ee5\u4f7f\u7528\u5404\u79cd\u5de5\u5177\u548c\u5e93\u6765\u7f16\u5199\u3001\u8c03\u8bd5\u548c\u7ba1\u7406sass\u4ee3\u7801\u3002<\/p>\n<p><strong>2. Sass\u6837\u5f0f\u9884\u5904\u7406\u4e2d\u4e3a\u4ec0\u4e48\u5fc5\u987b\u4f7f\u7528Ruby\uff1f<\/strong><br \/>\nRuby\u5728sass\u6837\u5f0f\u9884\u5904\u7406\u4e2d\u7684\u4f7f\u7528\u662f\u7531sass\u5f15\u64ce\u7684\u5b9e\u73b0\u51b3\u5b9a\u7684\u3002Sass\u5f15\u64ce\u662f\u7528Ruby\u7f16\u5199\u7684\uff0c\u56e0\u6b64\u53ea\u6709\u5728\u5b89\u88c5Ruby\u7684\u60c5\u51b5\u4e0b\uff0c\u624d\u80fd\u6b63\u786e\u5730\u7f16\u8bd1\u548c\u5904\u7406sass\u4ee3\u7801\u3002\u901a\u8fc7Ruby\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u4f7f\u7528sass\u7684\u6240\u6709\u7279\u6027\u548c\u529f\u80fd\uff0c\u5305\u62ec\u5d4c\u5957\u89c4\u5219\u3001\u53d8\u91cf\u3001\u6df7\u5408\u5b8f\u3001\u51fd\u6570\u7b49\u7b49\u3002<\/p>\n<p><strong>3. \u5982\u4f55\u5b89\u88c5\u548c\u914d\u7f6eRuby\u4ee5\u7528\u4e8esass\u6837\u5f0f\u9884\u5904\u7406\uff1f<\/strong><br \/>\n\u5b89\u88c5\u548c\u914d\u7f6eRuby\u975e\u5e38\u7b80\u5355\u3002\u9996\u5148\uff0c\u4f60\u9700\u8981\u4e0b\u8f7d\u548c\u5b89\u88c5Ruby\u7684\u6700\u65b0\u7248\u672c\u3002\u7136\u540e\uff0c\u6839\u636e\u64cd\u4f5c\u7cfb\u7edf\u7684\u4e0d\u540c\uff0c\u6309\u7167\u76f8\u5e94\u7684\u6b65\u9aa4\u8fdb\u884c\u914d\u7f6e\u3002\u5728\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u4f60\u9700\u8981\u4f7f\u7528Ruby\u7684\u5305\u7ba1\u7406\u5668\uff08\u4f8b\u5982RubyGems\uff09\u6765\u5b89\u88c5sass\u548c\u5176\u4ed6\u76f8\u5173\u7684gem\u5305\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u4f7f\u7528Ruby\u6765\u7f16\u8bd1\u548c\u5904\u7406sass\u4ee3\u7801\u4e86\u3002\u8bb0\u5f97\u5b9a\u671f\u66f4\u65b0Ruby\u548c\u76f8\u5173\u7684gem\u5305\uff0c\u4ee5\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u6700\u65b0\u7684\u7279\u6027\u548c\u4fee\u590d\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Sass\uff08Syntactically Awesome Stylesheets\uff09\u6837\u5f0f\u9884\u5904\u7406\u5668\u7684\u5fc5\u8981\u8f6f\u4ef6Ruby\u4e3b [&hellip;]","protected":false},"author":3,"featured_media":172659,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/172651"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=172651"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/172651\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/172659"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=172651"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=172651"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=172651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}