{"id":1221,"date":"2017-12-04T01:40:23","date_gmt":"2017-12-03T17:40:23","guid":{"rendered":"http:\/\/www.iooe.cn\/?p=1221"},"modified":"2017-12-04T01:40:23","modified_gmt":"2017-12-03T17:40:23","slug":"sass-%e7%8e%a9%e6%b3%95%e5%bc%84%e6%87%82%e4%ba%86%e4%b8%80%e7%82%b9","status":"publish","type":"post","link":"http:\/\/www.iooe.cn\/index.php\/2017\/12\/04\/sass-%e7%8e%a9%e6%b3%95%e5%bc%84%e6%87%82%e4%ba%86%e4%b8%80%e7%82%b9\/","title":{"rendered":"sass \u73a9\u6cd5\u5f04\u61c2\u4e86\u4e00\u70b9"},"content":{"rendered":"<p>\n\t\u5728\u505a\u4e00\u4e2a\u7f51\u7ad9\u65f6\u3002 \u662fbootstrap\uff0c \u4ed6\u7528\u4e86sass\u3002&nbsp; &nbsp;\u4e00\u5f00\u59cb\u4e00\u5934\u96fe\u6c34\u4e0d\u660e\u767d\u5565\u4e1c\u897f\u3002 \u4fee\u6539\u9875\u9762\u8272\u5f69\u4e5f\u4e0d\u5de5\u4f5c\u3002&nbsp;\n<\/p>\n<p>\n\t\u540e\u6765\u3002 \u770b\u4e86\u4e00\u4e0b\u8fd9\u4e9b\u5185\u5bb9\u3002 \u5927\u4f53\u660e\u767d\u4e86\u3002&nbsp;\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t1. \u5b89\u88c5sass \uff0c \u6211\u7684\u662fmac \u6309\u636e\u5982\u4e0b\uff1a\n<\/p>\n<p>\n\tsudo gem install sass\n<\/p>\n<p>\n\t\u6210\u529f\u540e\u3002&nbsp;\n<\/p>\n<p>\n\tsass -v&nbsp; \u770b\u6709\u8fd4\u56de\u7248\u672c\u53f7\u6ca1\u6709\u3002 \u6709\u5c31\u6210\u529f\u4e86\u3002&nbsp;\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t2. \u5f00\u542f\u7f16\u8bd1\u8c03\u5ea6\u4fe1\u606f\uff0c\u53ef\u4ee5\u7ed9\u8def\u5f84\u4fe1\u606f\u3002 \u6211\u7684\u662f\u653e\u5230css\uff0c \u6211\u7684\u7535\u8111\u5f00\u542f\u52a8\uff0c \u7535\u8111\u597d\u70ed\u3002&nbsp;\n<\/p>\n<pre>\r\n<code>sass --watch style.scss:..\/css\/style.css --debug-info<\/code><\/pre>\n<p>\n\t<code>3. \u7528chrome\u53bb\u8c03\u8bd5\u3002 \u770b\u4e8b\u9762\u7684\u5f00\u542f\u65b9\u6cd5\u3002&nbsp;<\/code>\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<h1>\n\tsass\u8c03\u8bd5<br \/>\n<\/h1>\n<p>\n\tsass\u8c03\u8bd5\u9700\u8981\u5f00\u542f\u7f16\u8bd1\u65f6\u8f93\u51fa\u8c03\u8bd5\u4fe1\u606f\u548c\u6d4f\u89c8\u5668\u8c03\u8bd5\u529f\u80fd\uff0c\u4e24\u8005\u7f3a\u4e00\u4e0d\u53ef\u3002\n<\/p>\n<h2>\n\t\u5f00\u542f\u7f16\u8bd1\u8c03\u8bd5\u4fe1\u606f<br \/>\n<\/h2>\n<p>\n\t\u76ee\u524dsass\u7684\u8c03\u8bd5\u5206\u4e3a\u4e24\u79cd\uff0c\u4e00\u79cd\u4e3a\u5f00\u542f<code>debug-info<\/code>\uff0c\u4e00\u79cd\u4e3a\u5f00\u542f<code>sourcemap<\/code>\uff08\u8fd9\u4e2a\u5c06\u6210\u4e3a\u4e3b\u6d41\uff09\u3002\n<\/p>\n<p>\n\t\u5982\u5f00\u542f\u7684\u662f<code>debug-info<\/code>\uff0c\u5219\u89e3\u6790\u7684css\u6587\u4ef6\u4e2d\u4f1a\u6709\u4ee5<code>@media -sass-debug-info<\/code>\u5f00\u5934\u7684\u4ee3\u7801\uff0c\u5982\u6ca1\u6709\u5219\u8868\u660e\u6ca1\u6709\u5f00\u542f\u3002\n<\/p>\n<p>\n\t\u5982\u5f00\u542f\u7684\u662f<code>sourcemap<\/code>\uff0c\u5219\u5728\u89e3\u6790\u7684css\u6587\u4ef6\u540c\u76ee\u5f55\u4e0b\u751f\u6210\u4e00\u4e2a<code>.css.map<\/code>\u7684\u540e\u7f00\u540d\u6587\u4ef6\u3002\n<\/p>\n<h3>\n\t\u547d\u4ee4\u884c\u5f00\u542f<br \/>\n<\/h3>\n<p>\n\t\u4e24\u4e2a\u7684\u547d\u4ee4\u5206\u522b\u4e3a<code>--debug-info<\/code>\uff0c<code>--sourcemap<\/code>\uff0c\u5f00\u542f\u5982\u4e0b\uff1a\n<\/p>\n<pre>\r\n<code>sass --watch style.scss:style.css --debug-info<\/code><\/pre>\n<pre>\r\n<code>sass --watch style.scss:style.css --sourcemap<\/code><\/pre>\n<h3>\n\tkoala\u5f00\u542f<br \/>\n<\/h3>\n<p>\n\t\u5982\u4e0b\u56fe\uff1a\u70b9\u51fb\u76f8\u5e94\u7684\u6587\u4ef6\uff0c\u7136\u540e\u5c31\u4f1a\u51fa\u73b0\u53f3\u8fb9\u7684\u7f16\u8bd1\u9009\u9879\uff0c\u5373\u53ef\u9009\u62e9\u662f\u5426\u5f00\u542f<code>source map<\/code>\uff0c<code>debug info<\/code>\n<\/p>\n<p>\n\t<img alt=\"koala setting\" src=\"https:\/\/www.w3cplus.com\/sassguide\/images\/koala-setting.jpg\" width=\"850\" \/>\n<\/p>\n<h2>\n\t\u5f00\u542f\u6d4f\u89c8\u5668\u8c03\u8bd5<br \/>\n<\/h2>\n<h3>\n\t\u8c37\u6b4c\u6d4f\u89c8\u5668\u8c03\u8bd5<br \/>\n<\/h3>\n<p>\n\tF12\u6253\u5f00\u8c03\u8bd5\u9762\u677f\uff0c\u70b9\u51fb\u8c03\u8bd5\u9762\u677f\u53f3\u4e0a\u89d2\u7684\u9f7f\u8f6e\u56fe\u6807\u6253\u5f00\u8bbe\u7f6e\uff0c\u5728<code>general<\/code>\u9009\u9879\u4e2d\u52fe\u9009<code>Enable CSS source map<\/code>&nbsp;\u548c&nbsp;<code>Auto-reload generated CSS<\/code>\u3002\n<\/p>\n<p>\n\t<img alt=\"open chrome css source map\" src=\"https:\/\/www.w3cplus.com\/sassguide\/images\/chrome-sourcemap1.jpg\" \/>\n<\/p>\n<p>\n\t\u5f00\u542f<code>--sourcemap<\/code>\u7f16\u8bd1\uff0c<code>f12<\/code>\u6253\u5f00\u8c03\u8bd5\u9762\u677f\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u539f\u5148\u53f3\u8fb9\u7684css\u6587\u4ef6\u53d8\u6210\u4e86\u6211\u4eec\u73b0\u5728\u7684scss\u6587\u4ef6\n<\/p>\n<p>\n\t<img alt=\"chrome scss\" src=\"https:\/\/www.w3cplus.com\/sassguide\/images\/chrome-sourcemap2.jpg\" \/>\n<\/p>\n<p>\n\t\u70b9\u51fbscss\u6587\u4ef6\uff0c\u4f1a\u8df3\u5230<code>source<\/code>\u91cc\u9762\u7684scss\u6e90\u6587\u4ef6\uff0c\u73b0\u5728\u53ef\u4ee5\u5728\u91cc\u9762\u8fdb\u884c\u4fee\u6539\uff0c\u4fee\u6539\u5b8c\u6210\u540e\u53ef\u4ee5\u53f3\u952e\u9009\u62e9<code>save<\/code>\u6216<code>save as<\/code>\u547d\u4ee4\uff0c\u7136\u540e\u66ff\u6362\u6211\u4eec\u672c\u5730\u7684scss\u6e90\u6587\u4ef6\uff0c\u5237\u65b0chrome\u5c31\u53ef\u4ee5\u770b\u5230\u53d8\u5316\uff08\u6ce8\u610f\uff0c\u89e3\u6790\u6837\u5f0f\u9700\u8981\u4e00\u5b9a\u65f6\u95f4\uff09\u3002\u4ee5\u540e\u53ea\u8981<code>ctrl+s<\/code>\u4fdd\u5b58\u4fee\u6539\u5c31\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u770b\u5230\u4fee\u6539\u6548\u679c\u4e86\u3002\n<\/p>\n<p>\n\t<img alt=\"chrome scss source\" src=\"https:\/\/www.w3cplus.com\/sassguide\/images\/chrome-sourcemap3.jpg\" \/>\n<\/p>\n<h3>\n\t\u706b\u72d0\u6d4f\u89c8\u5668\u8c03\u8bd5<br \/>\n<\/h3>\n<h4>\n\tdebug-info\u8c03\u8bd5<br \/>\n<\/h4>\n<p>\n\tfirefox\u53ef\u4ee5\u5b89\u88c5\u63d2\u4ef6<a href=\"https:\/\/addons.mozilla.org\/en-US\/firefox\/addon\/firesass-for-firebug\/\">FireSass<\/a>\u4f7f\u7528<code>debug-info<\/code>\u6765\u8c03\u8bd5\u3002\n<\/p>\n<p>\n\t\u5f00\u542f<code>--debug-info<\/code>\u7f16\u8bd1\uff0c<code>f12<\/code>\u6253\u5f00firebug\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u539f\u5148\u53f3\u8fb9\u7684css\u6587\u4ef6\u53d8\u6210\u4e86\u6211\u4eec\u73b0\u5728\u7684scss\u6587\u4ef6\n<\/p>\n<p>\n\t<img alt=\"firefox debug\" src=\"https:\/\/www.w3cplus.com\/sassguide\/images\/debug-scss.jpg\" \/>\n<\/p>\n<h4>\n\tsourcemap\u8c03\u8bd5<br \/>\n<\/h4>\n<p>\n\tfirefox 29 \u5c06\u4f1a\u5f00\u59cb\u652f\u6301<code>sourcemap<\/code>\uff0c\u6ce8\u610f\u662f\u706b\u72d0\u81ea\u5e26\u7684\u8c03\u8bd5\u529f\u80fd\uff0c\u800c\u4e0d\u662ffirebug\u3002\n<\/p>\n<p>\n\t\u5f00\u542f<code>--sourcemap<\/code>\u7f16\u8bd1\uff0c\u53f3\u952e&ldquo;\u67e5\u770b\u5143\u7d20&rdquo;\u91c7\u7528\u706b\u72d0\u81ea\u5e26\u7684\u8c03\u8bd5\u529f\u80fd\uff0c\u6253\u5f00\u8c03\u8bd5\u9762\u677f\uff0c\u5728\u6837\u5f0f\u4e0a\u53f3\u952e\u9009\u62e9&ldquo;\u663e\u793a\u539f\u59cb\u6765\u6e90&rdquo;\u3002\n<\/p>\n<p>\n\t<img alt=\"firefox sourcemap\" src=\"https:\/\/www.w3cplus.com\/sassguide\/images\/firefox-sourcemap1.jpg\" \/>\n<\/p>\n<p>\n\t\u70b9\u51fbscss\u6587\u4ef6\uff0c\u8fd9\u6837\u5c31\u8df3\u5230\u4e86scss\u6587\u4ef6\u3002\u5982\u4e0b\u56fe\uff1a\n<\/p>\n<p>\n\t<img alt=\"firefox sourcemap\" src=\"https:\/\/www.w3cplus.com\/sassguide\/images\/firefox-sourcemap2.jpg\" \/>\n<\/p>\n<p>\n\t\u7136\u540e\u5c31\u53ef\u4ee5\u8fdb\u884c\u6211\u4eec\u7684\u4fee\u6539\u4e86\uff0c\u4fee\u6539\u4e4b\u540e\u70b9\u51fb\u4fdd\u5b58\u6216\u8005&#39;ctrl+s&#39;\u5f39\u51fa\u6211\u4eec\u8981\u4fdd\u5b58\u5230\u54ea\u91cc\uff0c\u540c\u8c37\u6b4c\u4e00\u6837\u76f4\u63a5\u8986\u76d6\u5230\u6211\u4eec\u672c\u5730\u7684\u6e90\u6587\u4ef6\u5c31ok\u4e86\u3002\n<\/p>\n<p>\n\t<img alt=\"firefox sourcemap\" src=\"https:\/\/www.w3cplus.com\/sassguide\/images\/firefox-sourcemap3.jpg\" \/>\n<\/p>\n<p>\n\t<strong>ps\uff1a<\/strong>\u6211\u752829 beta\u7248\u672c\u7684\u65f6\u5019\u8fd9\u4e2a\u529f\u80fd\u4e0d\u592a\u7a33\u5b9a\uff0c\u4f30\u8ba1\u5230\u7a33\u5b9a\u7248\u672c\u5e94\u8be5\u5c31\u597d\u4e86\u3002\u540c\u65f6\u671f\u5f85<code>FireSass<\/code>\u8fd9\u4e2a\u63d2\u4ef6\u5347\u7ea7\u652f\u6301sourcemap\u3002\n<\/p>\n<p>\n\t&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u505a\u4e00\u4e2a\u7f51\u7ad9\u65f6\u3002 \u662fbootstrap\uff0c \u4ed6\u7528\u4e86sass\u3002&nbsp; &nbsp;\u4e00\u5f00\u59cb\u4e00\u5934\u96fe\u6c34\u4e0d\u660e\u767d\u5565\u4e1c\u897f\u3002 \u4fee\u6539\u9875\u9762\u8272\u5f69\u4e5f\u4e0d\u5de5\u4f5c\u3002&nbsp; \u540e\u6765\u3002 \u770b&#8230; <\/p>\n<div class='button-mores'><a href='http:\/\/www.iooe.cn\/index.php\/2017\/12\/04\/sass-%e7%8e%a9%e6%b3%95%e5%bc%84%e6%87%82%e4%ba%86%e4%b8%80%e7%82%b9\/'> \u9605\u8bfb\u66f4\u591a&#8230; <\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts\/1221"}],"collection":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1221"}],"version-history":[{"count":1,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts\/1221\/revisions"}],"predecessor-version":[{"id":1222,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts\/1221\/revisions\/1222"}],"wp:attachment":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1221"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}