{"id":2464,"date":"2012-06-29T01:09:08","date_gmt":"2012-06-28T17:09:08","guid":{"rendered":"http:\/\/www.zhangxinxu.com\/wordpress\/?p=2464"},"modified":"2019-10-17T23:39:44","modified_gmt":"2019-10-17T15:39:44","slug":"stylus-nodejs-expressive-dynamic-robust-css","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2012\/06\/stylus-nodejs-expressive-dynamic-robust-css\/","title":{"rendered":"Stylus-NodeJS\u4e0b\u6784\u5efa\u66f4\u5bcc\u8868\u73b0\u529b\/\u52a8\u6001\/\u5065\u58ee\u7684CSS"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/\">https:\/\/www.zhangxinxu.com<\/a><br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=2464\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=2464<\/a><\/p>\n<h4>Stylus\u4e2d\u6587\u6587\u6863<\/h4>\n<p><a href=\"https:\/\/www.zhangxinxu.com\/jq\/stylus\/\" rel=\"noopener\" target=\"_blank\" class=\"a_link\">\u72ec\u5bb6\u7ffb\u8bd1stylus\u53c2\u8003\u6587\u6863\u4e2d\u6587\u7248<\/a><\/p>\n<h3>\u4e00\u3001\u4e3a\u4ec0\u4e48\u6211\u4f1a\u8bb2Stylus\uff0c\u800c\u4e0d\u662fSASS\u548cLESS\uff1f<\/h3>\n<p><a href=\"https:\/\/sass-lang.com\/\">SASS<\/a>\u663e\u7136\u4f18\u4e8eLESS\uff08\u6240\u4ee5LESS\u4f60\u5c31\u4f11\u606f\u53bb\u5427\uff09\uff0cSASS\u521a\u51fa\u6765\u7684\u65f6\u5019\u6211\u5c31\u5728\u6587\u7ae0\u6709\u6709\u6240\u63d0\u5230\uff0c\u73b0\u5728\u8c8c\u4f3c\u5df2\u7ecf\u88ab\u5f88\u591a\u540c\u884c\u719f\u77e5\uff0c\u751a\u81f3\u6709\u4e9b\u5c0f\u4f17\u9879\u76ee\u7ec4\u5df2\u7ecf\u4f7f\u7528\u4e4b\u3002<\/p>\n<p>\u7136\u800c\uff0c\u6211\u5374\u6ca1\u6709\u4e13\u95e8\u82b1\u529f\u592b\u4ecb\u7ecdSASS, \u4e3a\u4f55\uff1f\u90a3\u4e3a\u4f55\u73b0\u5728\u53c8\u82b1\u5927\u628a\u529f\u592b\u6574\u7406\u548c\u4ecb\u7ecdStylus\uff1f\u5f02\u540c\u5728\u4f55\u5904\uff1f<\/p>\n<p><span class=\"s\">\uff08\u4ee5\u4e0b\u6709\u8868\u8ff0\u4e0d\u51c6\u786e\u4e4b\u5904\u6b22\u8fce\u6307\u6b63\uff09<\/span><\/p>\n<p><strong>\u9700\u8981\u7684\u8bed\u8a00<\/strong><br \/>\nSASS\u8fd9\u4e2a\u4e1c\u897f\u662f\u5f88\u597d\u7684\uff0c\u60f3\u6cd5\u4e5f\u662f\u5f88\u4e0d\u9519\u7684\uff0c\u6539\u53d8\u4e86\u6211\u4eec\u4e66\u5199CSS\u7684\u4e60\u60ef\uff0c\u719f\u7ec3\u4e4b\u540e\uff0c\u5199CSS\u7684\u6548\u7387\u4f1a\u5927\u5927\u63d0\u5347\u3002\u4f46\u6211\u5bf9\u5176\u53ea\u662f\u4e00\u7b14\u5e26\u8fc7\uff0c\u4e3b\u8981\u539f\u56e0\u662f\u5176\u5b66\u4e60\u6210\u672c\uff0c\u51c6\u786e\u8bf4\uff0c\u662f\u5b89\u88c5SASS\u5fc5\u987b\u5148\u5b89\u88c5\u7684<strong>Ruby<\/strong>\u8fd9\u95e8\u8bed\u8a00\u7684\u5b66\u4e60\u6210\u672c\u3002<\/p>\n<p>SASS\u6211\u6ca1\u6709\u5b9e\u8df5\u8fc7\uff0c\u4e5f\u4e0d\u77e5\u9053\u5176\u4e2d\u662f\u5426\u7528\u5230\u4e86Ruby\u8bed\u8a00\u3002\u4f46\u662f\uff0c\u663e\u7136\uff0c\u63a5\u89e6\u662f\u65e0\u53ef\u907f\u514d\u5730\u3002\u8003\u8651\u5230\uff1a<\/p>\n<ol>\n<li>\u5927\u591a\u6570\u6240\u8c13\u524d\u7aef\u662f\u5199\u9875\u9762\u8fc7\u6765\u7684\uff0c\u7a0b\u5e8f\u5c31\u662f\u4e2a\u8f6f\u808b\uff0cRuby?\u5f97\u4e86\u5427\uff0c\u4ed6\u4eecJS\u7684\u6570\u7ec4\u8fd8\u6ca1\u7528\u719f\u5462\uff01<\/li>\n<li>\u4e00\u95e8\u4e0e\u81ea\u5df1\u804c\u4e1a\u5173\u7cfb\u4e0d\u5927\u7684\u8bed\u8a00\uff0c\u5f88\u5c11\u542c\u8fc7\u7684\u8bed\u8a00\uff0c\u7b97\u4e86\u5427\uff0c\u82b1\u529f\u592b\u5b66\u8fd9\u4e2a\u5c31\u662f\u6d6a\u8d39\u9752\u6625\u5e74\u534e\u554a\uff01<\/li>\n<\/ol>\n<p>\u56e0\u6b64\uff0c\u5f88\u591a\u4eba\u4f1a\u9000\u5374\uff0c\u5176\u4e2d\u5c31\u6709\u6211\uff0c\u6211\u4e0d\u60f3\u82b1\u529f\u592b\u53bb\u5b66\u4e60\u751a\u81f3\u719f\u6089Ruby\uff0c\u56e0\u4e3a\u81ea\u5df1\u89c9\u5f97\uff0c\u6709\u8fd9\u529f\u592b\uff0c\u8fd8\u4e0d\u5982\u628aJS\u518d\u624e\u5b9e\u624e\u5b9e\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u6211\u770b\u5230Stylus\u540e\uff0c\u773c\u775b\u5c31\u4eae\u4e86\uff01\u4f60\u9700\u8981\u7684\u4e0d\u518d\u662fRuby\u4e86\u800c\u662fNodeJS.<\/p>\n<p>NodeJS\u5927\u5bb6\u5e94\u8be5\u90fd\u719f\u77e5\uff0cv8\u5f15\u64ce\u4e0b\u7684JavaScript\u5e73\u53f0\u8fd8\u662f\u4ec0\u4e48\u79f0\u547c\u7684\u3002\u603b\u4e4b\uff0c\u521b\u5efa\u7684\u662fjs\u6587\u4ef6\uff0c\u4f7f\u7528\u7684\u662fJavaScript\u8bed\u8a00\u3002<\/p>\n<p>\u6362\u8a00\u4e4b\uff0c\u5c31\u662f\uff0c\u6211\u4eec\u4f7f\u7528\u8bed\u501f\u52a9JavaScript\u8ba9CSS\u66f4\u5bcc\u6709\u8868\u73b0\u529b\uff0c\u66f4\u52a8\u6001\uff0c\u66f4\u5065\u58ee\uff01<\/p>\n<p>\u524d\u7aef\u4e24\u5927\u7cbe\u9510CSS\u4e0eJS\u53ef\u4ee5\u5982\u6b64\u641e\u57fa\uff01\u5c31\u7b97\u4f60\u4e0d\u8150\uff0c\u4e5f\u80af\u5b9a\u4f1a\u5174\u594b\u7684\u554a\uff01\u4e00\u5207\u90fd\u5728\u524d\u7aef\u81ea\u5df1\u5185\u90e8\u6d88\u5316\uff0c\u78e8\u5408\u4e0e\u63d0\u5347\uff0c\u6211\u89c9\u5f97\u8fd9\u4e2a\u663e\u7136\u8981\u6bd4SASS\u66f4\u5bb9\u6613\u8ba9\u8bf8\u591a\u540c\u884c\u4eec\u63a5\u53d7\u3002<\/p>\n<p><strong>window\u652f\u6301<\/strong><br \/>\n\u6211\u4eec\u5f88\u591a\u540c\u884c\u7684\u7535\u8111\u5e76\u4e0d\u662fLinux\u6216OS X\u7cfb\u7edf\uff0c\u800c\u662fwindow\u7cfb\u7edf\u3002\u5728nodejs\u521a\u51fa\u6765\u7684\u65f6\u5019\uff0cwindow\u7cfb\u7edf\u53ea\u80fd\u770b\u7740\u522b\u4eba\u7684\u9505\u7076\u6d41\u53e3\u6c34\u3002\u4f46\u662f\uff0c\u73b0\u5728\uff0cwindow\u7cfb\u7edf\u4e5f\u652f\u6301nodejs\u4e86\uff0c\u800c\u4e14\u5b89\u88c5\u8d85\u7ea7\u65b9\u4fbf\uff08\u8fd9\u4e2a\u56de\u5934\u4f1a\u4ecb\u7ecd\uff09\uff0c\u9644\u5e26\u5e38\u7528npm\u5e93\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u8fd9\u4e2a\u5927\u80cc\u666f\u7684\u652f\u6301\u4f7f\u6211\u8ba4\u4e3aStylus\u53ef\u4ee5\u88ab\u5e7f\u5927\u540c\u884c\u591a\u719f\u77e5\uff0c\u81f3\u5c11\uff0c\u81ea\u5df1\u624b\u52a8\u641e\u4e2a\u5c0fdemo\u4ec0\u4e48\u7684\u7edd\u5bf9\u6ca1\u95ee\u9898\uff0c\u8fd9\u5c31\u8db3\u591f\u4e86\uff01<\/p>\n<p><strong>\u8f6c\u6298<\/strong><br \/>\n\u7136\u800c\uff0c\u6211\u5e76\u6ca1\u6709\u591a\u5c11\u5b9e\u8df5\u7ecf\u9a8c\uff0c\u540c\u65f6\uff0c\u5bf9\u4e8e\u5176\u4ee3\u7801\u5b9e\u73b0\u4e5f\u5e76\u6ca1\u6709\u6df1\u7a76\u3002\u56e0\u6b64\uff0c\u5982\u679c\u5bf9\u6bd4\u5b9e\u7528\u6027\u4ee5\u53ca\u4ee3\u7801\u8d28\u91cf\u7b49\u65b9\u9762\uff0cStylus\u662f\u5426\u6bd4SASS\u66f4\u4f18\u79c0\uff0c\u6211\u5c31\u65e0\u6cd5\u786e\u5b9a\u4e86\uff01<\/p>\n<h3>\u4e8c\u3001\u8bf4\u8fd9\u591a\uff0cStylus\u7a76\u7adf\u662f\u4f55\u65b9\u5996\u5b7d\u554a\uff1f<\/h3>\n<p>\u9996\u5148\uff0cStylus\u5f88\u5e74\u8f7b\uff0c\u6700\u8fd1\u624d\u51fa\u6765\u3002<\/p>\n<p>\u5176\u6b21\uff0c\u5176\u672c\u8d28\u4e0a\u505a\u7684\u4e8b\u60c5\u4e0eSASS\/LESS\u7b49\u7c7b\u4f3c\uff08\u56e0\u6b64\u6709\u5f88\u591a\u501f\u9274\uff09\uff0c\u4ee5\u8fd1\u4f3c\u811a\u672c\u7a0b\u5e8f\u7684\u65b9\u5f0f\u4e66\u5199CSS\u4ee3\u7801\u3002\u4f8b\u5982\uff0c\u5173\u4e8eCSS3\u5706\u89d2\u4ee3\u7801\uff0c\u53ef\u80fd\u5c31\u4f1a\u4f7f\u4e0b\u9762\u8fd9\u6837\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>border-radius()\r\n  -webkit-border-radius arguments\r\n  -moz-border-radius arguments\r\n  border-radius arguments\r\n\r\na.button\r\n  border-radius 5px<\/pre>\n<\/div>\n<p>\u5c3c\u739b\uff0c\u5206\u53f7\u554a\uff0c\u9017\u53f7\u554a\uff0c\u5192\u53f7\u554a\u4ec0\u4e48\u7684\u90fd\u7ed9\u9609\u5272\u4e86\uff0c\u8fd8\u83ab\u540d\u591a\u4e86<code>arguments<\/code>\u548c\u7c7b\u4f3c\u51fd\u6570\u7684\u4e1c\u897f\u3002<\/p>\n<p>\u7b2c\u4e09\uff0c\u9ed8\u8ba4\u4e0eNodeJS\u8d70\u5f97\u5f88\u8fd1\uff0c\u4e0ejs\u8054\u7cfb\u7d27\u5bc6\u3002<\/p>\n<p>\u7b2c\u56db\uff0c\u652f\u6301Ruby\u4e4b\u7c7b\u6846\u67b6\uff0c\u6709FireBug\u63d2\u4ef6\uff0c\u4ee5\u53ca\u5176\u4ed6\u2026\u2026\u2026\u2026\u2026\u2026N\u591a\u7279\u5f81<\/p>\n<h3>\u4e09\u3001\u6025\u4e86\uff0c\u5148\u770b\u6211\u7ffb\u8bd1\u7684\u6587\u6863\u5427\uff01<\/h3>\n<p>\u8fde\u7eed\u51e0\u5929\u5fd9\u523011\u70b9\u591a\uff08\u665a\u4e0a\uff09\uff0c\u5c31\u662f\u7ffb\u8bd1Stylus\u7684\u5b98\u65b9\u6587\u6863\u3002\u5927\u5bb6\u4e0d\u70b9\u51fb\u4e00\u4e0b\u5b9e\u5728\u5bf9\u4e0d\u4f4f\u6211\u554a\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" target=\"_blank\" href=\"https:\/\/www.zhangxinxu.com\/jq\/stylus\/\" style=\"color:#c30;\">stylus\u53c2\u8003\u6587\u6863\u4e2d\u6587\u7248<\/a><\/p>\n<p>\u975e\u5e38\u8be6\u7ec6\u5730\u4ecb\u7ecd\u4e86Stylus\u7684\u5404\u7c7b\u7528\u6cd5\u3002\u6211\u7684\u4f53\u4f1a\u662f\uff0c\u8fd9\u4e1c\u897f\u5f88\u5f3a\u5927\uff0c\u5c31\u50cf\u4e2a\u65b0\u7684\u8bed\u8a00\u4e00\u6837\uff01<\/p>\n<p>\u6587\u6863\u5de6\u8fb9\u4e3a\u7279\u5f81\u4eec\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"Stylus\u4e2d\u6587\u7248\u53c2\u8003\u6587\u6863\u5de6\u4fa7\u680f\u622a\u56fe \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/201206\/2012-06-29_001605.png\" title=\"Stylus\u4e2d\u6587\u7248\u53c2\u8003\u6587\u6863\u5de6\u4fa7\u680f\u622a\u56fe\" class=\"alignnone\" width=\"243\" height=\"295\" \/><\/p>\n<p>\u53f3\u8fb9\u4e3a\u8be6\u7ec6\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"Stylus\u4e2d\u6587\u53c2\u8003\u9875\u9762\u8be6\u7ec6\u90e8\u5206\u622a\u56fe \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/201206\/2012-06-29_002535.png\" title=\"Stylus\u4e2d\u6587\u53c2\u8003\u9875\u9762\u8be6\u7ec6\u90e8\u5206\u622a\u56fe\" class=\"alignnone\" width=\"388\" height=\"326\" \/><\/p>\n<p>\u5f88\u7b80\u5355\u7684\u754c\u9762\uff0c\u4f7f\u7528\u90fd\u61c2\u7684\u3002<\/p>\n<p>\u81f3\u4e8e\u91cc\u9762\u7684\u5185\u5bb9\u561b~~\u6211\u81ea\u5df1\u4e5f\u6709\u4e0d\u5c11\u4e0d\u61c2\u7684\u5730\u65b9\uff0c\u52a0\u4e0a\u65f6\u95f4\u4ed3\u4fc3\u554a\uff0c\u4ee5\u53ca\u672c\u8eab\u62d9\u52a3\u7684\u82f1\u8bed\u3002\u56e0\u6b64\uff0c\u80af\u5b9a\u6709\u4e0d\u5c11\u8868\u8ff0\u4e0d\u51c6\u786e\u7684\u5730\u65b9\uff0c\u5927\u5bb6\u4e00\u5b9a\u8981\u6307\u51fa\u6765\u554a\uff0c\u6211\u4f1a\u53ca\u65f6\u66f4\u6b63\u7684\u3002<\/p>\n<h3>\u56db\u3001Stylus\u7684\u83b7\u53d6\u4e0e\u5b89\u88c5<\/h3>\n<p>Stylus\u5b89\u88c5\u5982\u4e0b\uff1a<br \/>\n\u5982\u679c\u60a8\u7684\u7535\u8111\u5df2\u7ecf\u5b89\u88c5\u4e86nodejs\uff0c\u5219\u4e0d\u8c08~~\uff1b\u5982\u679c\u6ca1\u6709\u5148\u53bb<a target=\"_blank\" href=\"http:\/\/nodejs.org\/#download\">nodejs\u5b98\u65b9\u4e0b\u8f7d\u9875\u9762<\/a>\u4e0b\u8f7d\u5b89\u88c5nodejs\uff0c\u652f\u6301window\u7cfb\u7edf\uff0c\u76f4\u63a5\u53cc\u51fb\u5b89\u88c5\u3002\u7136\u540e\uff0c\u5b89\u88c5stylus\u5305\uff0c\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>$ npm install stylus<\/pre>\n<\/div>\n<p>\u7136\u540e\uff0c\u5c31\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u5b89\u88c5\u6700\u65b0\u7684stylus\u5e93\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"Stylus\u4e0b\u8f7d\u4e0e\u5b89\u88c5\u622a\u56fe \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/201206\/2012-06-26_142852.png\" title=\"Stylus\u4e0b\u8f7d\u4e0e\u5b89\u88c5\u622a\u56fe\" class=\"alignnone\" width=\"558\" height=\"226\" \/><\/p>\n<p>\u7136\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u6309\u7167\u6587\u6863\u6216<a href=\"https:\/\/github.com\/learnboost\/stylus\">github<\/a>\u4e0a\u7684\u8bf4\u660e\u6784\u5efa\u66f4\u6709\u8da3\u7684CSS\u4ee3\u7801\u4e86\uff01\uff01<\/p>\n<h3>\u4e94\u3001Stylus\u5e94\u7528\u5b9e\u4f8b<\/h3>\n<p>\u603b\u89c9\u5f97\u809a\u5b50\u91cc\u6709\u5f88\u591a\u8bdd\u8981\u8bf4\uff0c\u4f46\u53c8\u5012\u4e0d\u51fa\u6765\uff0c\u6b63\u597d\u5e94\u4e86\u90a3\u53e5\u6b47\u540e\u8bed\uff1a\u8336\u58f6\u5012\u997a\u5b50\u2014\u2014\u51fa\u4e0d\u6765\u3002<\/p>\n<p>\u7f62\u4e86\uff0c\u7ed9\u4e2a\u4f8b\u5b50\u5427\uff0c\u7136\u540e\u5c31\u64a4\u4e86\u3002\u6211\u81ea\u5df1\u5439\u5f97\u5929\u82b1\u4e71\u5760\u4e00\u70b9\u7528\u90fd\u6ca1\u6709\uff0c\u8fd8\u5f97\u60a8\u81ea\u5df1\u4f53\u4f1a\uff0c\u7422\u78e8\u554a~~<\/p>\n<p><strong>1. \u65b0\u5efaCSS\u6587\u4ef6<\/strong><br \/>\n\u8bdd\u867d\u8bf4\u662fCSS\u6587\u4ef6\uff0c\u4f60\u5efa\u4e2atxt\u6587\u6863\u4e5f\u662f\u53ef\u4ee5\u7684\u3002\u5b98\u65b9\u6253\u5305\u8d44\u6e90\u663e\u793a\u7684\u662f<code>.styl<\/code>\u683c\u5f0f\u7684\u6587\u4ef6\uff0c\u57fa\u672c\u4e0a\u4e5f\u5c31\u662ftxt\u6587\u6863\u6539\u4e2a\u540e\u7f00\u540d\u3002\u8fd9\u91cc\uff0c\u6211\u5c31\u7701\u70b9\u529f\u592b\uff0c\u76f4\u63a5CSS\u6587\u4ef6\u4e86\uff0c\u5982\u4e0bCSS\u4ee3\u7801\uff08\u4e3b\u8981\u53c2\u8003<a href=\"https:\/\/github.com\/learnboost\/stylus\">github\u9996\u9875<\/a>\u4e0a\u7684CSS\u4ee3\u7801\u4f8b\u5b50\uff0c\u6709\u4e9b\u8bb8\u6539\u52a8\uff09\uff08\u5047\u8bbe\u6587\u4ef6\u4e3astylus.css\uff09\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>border-radius()\r\n  -webkit-border-radius: arguments\r\n  -moz-border-radius: arguments\r\n  border-radius: arguments\r\n\r\nbody a\r\n  display inline-block\r\n  padding: 2px 5px\r\n  font: 12px\/1.4 Arial, sans-serif\r\n  background: black\r\n  color: #eee\r\n  border-radius: 2px\r\n\r\nform input\r\n  padding: 5px\r\n  border: 1px solid\r\n  border-radius: 5px<\/pre>\n<\/div>\n<p><strong>2. nodejs\u4e0b\u7684\u6e32\u67d3<\/strong><br \/>\n\u597d\u4e86\uff0c\u73b0\u5728\u5c31\u662fnodejs\u7684\u5de5\u4f5c\u4e86\uff0c\u6211\u4eec\u65b0\u5efa\u4e2ajs\u6587\u4ef6\uff0c\u5047\u8bbe\u540d\u53eb<code>stylus_test.js<\/code>, \u7136\u540e\u5176\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>var css = require(\"stylus\"), \r\n    str = require(\"fs\").readFileSync(\"stylus.css\", \"utf8\");\r\n\t\r\ncss.render(str, { filename: \"stylus.css\" }, function(err, css) {\r\n    if (err) throw err;\r\n    <span style=\"color:#000;\">var http = require('http');\r\n    http.createServer(function (req, res) {\r\n        res.writeHead(200, {'Content-Type': 'text\/css'});\r\n        res.end(<span style=\"color:#cd0000;\">css<\/span>);\r\n    }).listen(1337, '127.0.0.1');\r\n    console.log('\u5df2\u7ecf\u542f\u52a8 http:\/\/127.0.0.1:1337\/');<\/span>\r\n});<\/pre>\n<\/div>\n<p>\u4e0a\u9762\u4ee3\u7801\u5f88\u7b80\u5355\u4e5f\u5f88\u57fa\u672c\uff1a\u8bf7\u6c42<code>\"stylus\"<\/code>\u5305\uff0c\u8bfb\u6587\u4ef6\uff0c\u7136\u540e\u6e32\u67d3\u3002\u5176\u4e2d<code>function(err, css)<\/code>\u8fd9\u91cc\u7684<code>css<\/code>\u5c31\u662f\u6e32\u67d3\u4e4b\u540e\u8fd4\u56de\u7684CSS\u4ee3\u7801\u5185\u5bb9\uff0c\u4e5f\u5c31\u662f\u8981\u5728\u9875\u9762\u4e0a\u663e\u793a\u7684CSS\u4ee3\u7801\u5185\u5bb9\u3002<\/p>\n<p>\u800c\u91cc\u9762\u51e0\u884c\u9ed1\u8272\u7684<code>http<\/code>\u76f8\u5173\u7684\u4ee3\u7801\u53ea\u662f\u7528\u6765\u542f\u52a8\u670d\u52a1\u5668\u5e76\u521b\u5efa\u4e2aCSS\u6587\u4ef6\u800c\u5df2\u3002<\/p>\n<p><strong>3. \u6d4b\u8bd5\u7684HTML\u9875\u9762<\/strong><br \/>\nHTML\u9875\u9762\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;link rel=\"stylesheet\" href=\"http:\/\/127.0.0.1:1337\" type=\"text\/css\" \/>\r\n\r\n&lt;form>\r\n    &lt;input type=\"text\" \/>&lt;a href=\"#\">\u786e\u5b9a&lt;\/a>\r\n&lt;\/form><\/pre>\n<\/div>\n<p><strong>4. \u542f\u52a8\u4e0e\u8fd0\u884c<\/strong><br \/>\n\u6253\u5f00cmd.exe\uff0c\u7c7b\u4f3c\u4e0b\u56fe\u7684\u8f93\u5165\uff08\u5177\u4f53\u4ee3\u7801\u4e0e\u9879\u76ee\u76ee\u5f55\u6709\u5173\uff09\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"Stylus\u6d4b\u8bd5cmd\u542f\u52a8\u4ee3\u7801 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/201206\/2012-06-29_005813.png\" title=\"Stylus\u6d4b\u8bd5cmd\u542f\u52a8\u4ee3\u7801\" class=\"alignnone\" width=\"575\" height=\"266\" \/><\/p>\n<p>\u7136\u540e\uff0c\u8bbf\u95ee\u6211\u4eec\u7684\u9759\u6001\u9875\u9762\uff0c\u5c31\u4f1a\u6709\u4e0b\u56fe\u6240\u793a\u7684\u6548\u679c\u4e86\uff08\u622a\u81eaFireFox\u6d4f\u89c8\u5668\uff09\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\u9875\u9762\u6548\u679c\u622a\u56fe\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/201206\/2012-06-29_010105.png\" title=\"\u9875\u9762\u6548\u679c\u622a\u56fe\" class=\"alignnone\" width=\"312\" height=\"113\" \/><\/p>\n<p>\u6b64\u65f6\uff0c\u4f7f\u7528firebug\u67e5\u770b\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u6211\u4eec\u751f\u6210\u7684CSS\u4ee3\u7801\u54af\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\u751f\u6210\u7684CSS\u4ee3\u7801\u67e5\u770b \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/201206\/2012-06-29_010239.png\" title=\"\u751f\u6210\u7684CSS\u4ee3\u7801\u67e5\u770b\" class=\"alignnone\" width=\"320\" height=\"229\" \/><\/p>\n<p>\u672c\u6587\u6ca1\u6709\u7ed3\u8bed\uff0c\u81f3\u6b64\u5927\u7ed3\u5c40\u3002<\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u6765\u81ea<a href=\"https:\/\/www.zhangxinxu.com\/\">\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b<\/a>[<a href=\"https:\/\/www.zhangxinxu.com\/\">https:\/\/www.zhangxinxu.com<\/a>]<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=2464\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=2464<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=2464\" ttile=\"\u70b9\u51fb\u67e5\u770b\u672c\u6587\"><img decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/201206\/daishuxiong.jpg\" height=\"170\" class=\"imgpad mb10\" \/><\/a><br \/>\nSASS\u663e\u7136\u4f18\u4e8eLESS\uff08\u6240\u4ee5\u4f60\u5c31\u4f11\u606f\u53bb\u5427\uff09\uff0cSASS\u521a\u51fa\u6765\u7684\u65f6\u5019\u6211\u5c31\u5728\u6587\u7ae0\u6709\u6709\u6240\u63d0\u5230\uff0c\u73b0\u5728\u8c8c\u4f3c\u5df2\u7ecf\u88ab\u5f88\u591a\u540c\u884c\u719f\u77e5\uff0c\u751a\u81f3\u6709\u4e9b\u5c0f\u4f17\u9879\u76ee\u7ec4\u5df2\u7ecf\u4f7f\u7528\u4e4b\u3002<br \/>\n\u7136\u800c\uff0c\u6211\u5374\u6ca1\u6709\u4e13\u95e8\u82b1\u529f\u592b\u4ecb\u7ecdSASS, \u4e3a\u4f55\uff1f\u90a3\u4e3a\u4f55\u73b0\u5728\u53c8\u82b1\u5927\u628a\u529f\u592b\u6574\u7406\u548c\u4ecb\u7ecdStylus\uff1f\u5f02\u540c\u5728\u4f55\u5904\uff1f\u2026\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[177,1271,728,484,727,353],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/2464"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2464"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/2464\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}