久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='jzdlw'><style id='jzdlw'><dir id='jzdlw'><q id='jzdlw'></q></dir></style></legend>
    • <bdo id='jzdlw'></bdo><ul id='jzdlw'></ul>
  • <tfoot id='jzdlw'></tfoot>
    <i id='jzdlw'><tr id='jzdlw'><dt id='jzdlw'><q id='jzdlw'><span id='jzdlw'><b id='jzdlw'><form id='jzdlw'><ins id='jzdlw'></ins><ul id='jzdlw'></ul><sub id='jzdlw'></sub></form><legend id='jzdlw'></legend><bdo id='jzdlw'><pre id='jzdlw'><center id='jzdlw'></center></pre></bdo></b><th id='jzdlw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='jzdlw'><tfoot id='jzdlw'></tfoot><dl id='jzdlw'><fieldset id='jzdlw'></fieldset></dl></div>

        <small id='jzdlw'></small><noframes id='jzdlw'>

        如何在 Polymer 組件中使用 Sass

        How to use Sass inside a Polymer component(如何在 Polymer 組件中使用 Sass)
            <tbody id='RFTHG'></tbody>

              <i id='RFTHG'><tr id='RFTHG'><dt id='RFTHG'><q id='RFTHG'><span id='RFTHG'><b id='RFTHG'><form id='RFTHG'><ins id='RFTHG'></ins><ul id='RFTHG'></ul><sub id='RFTHG'></sub></form><legend id='RFTHG'></legend><bdo id='RFTHG'><pre id='RFTHG'><center id='RFTHG'></center></pre></bdo></b><th id='RFTHG'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='RFTHG'><tfoot id='RFTHG'></tfoot><dl id='RFTHG'><fieldset id='RFTHG'></fieldset></dl></div>
                <bdo id='RFTHG'></bdo><ul id='RFTHG'></ul>

                <small id='RFTHG'></small><noframes id='RFTHG'>

                <tfoot id='RFTHG'></tfoot>
              • <legend id='RFTHG'><style id='RFTHG'><dir id='RFTHG'><q id='RFTHG'></q></dir></style></legend>

                • 本文介紹了如何在 Polymer 組件中使用 Sass的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  我目前使用 Polymer 作為我的前端開發(fā)框架.我喜歡薩斯.現(xiàn)在我知道我可以像往常一樣創(chuàng)建一個(gè) Sass 文件并導(dǎo)入它.

                  I'm currently using Polymer as my front end development framework. I love SASS. Now I understand I can create a Sass file and import it like I normally would.

                  不過,我已經(jīng)養(yǎng)成了在我的 Web 組件中使用樣式標(biāo)簽的習(xí)慣.

                  However, I've really gotten into the habit of using style tags within my web components.

                  基本上,我正在尋找的工作流程是能夠在我的 Web 組件中簡單地定義一個(gè)腳本標(biāo)簽,也許可以添加 type='sass;給它.然后在將文件輸出到我的 .tmp 目錄之前,讓 grunt 編譯這些標(biāo)簽中的所有 SASS.

                  Basically the workflow I am looking for is to be able to simply define a script tag within my Web Component maybe add type='sass; to it. Then have grunt go through and compile all of my SASS within those tags before outputting the files to my .tmp directory.

                  像 Grunt 或 Gulp 這樣的東西可以實(shí)現(xiàn)嗎?如果是這樣,什么是幫助我實(shí)現(xiàn)這一目標(biāo)的最佳模塊?

                  Is something like this achievable with something like Grunt or Gulp? If so what are the best modules to help me achieve this?

                  推薦答案

                  我的實(shí)現(xiàn)是基于 Polymer html 文件中的標(biāo)簽替換.我正在使用 gulp 但可以更改為簡單地使用 fs.

                  My implementation is based on a replacement of a tag inside the Polymer html file. I'm using gulp but could be changed to use simply fs.

                  文件結(jié)構(gòu)應(yīng)該是這個(gè)例子:

                  The files structure should be as this example:

                  app-view
                   |- app-view.html
                   |- app-view.scss
                  

                  app-view.html:

                  <dom-module id="app-view">
                      <template>
                          <style>
                              <!-- inject{scss} -->
                          </style>
                      </template>
                  </dom-module>
                  

                  app-view.scss:

                  :host{
                      margin-top: 50px;
                      justify-content: center;
                      display: flex;
                  }
                  #container{
                      font-size: 12px;
                      h1{
                          font-size: 20px;
                      }
                  }
                  

                  gulpfile.js:

                  var gulp = require('gulp');
                  var nodeSass = require('node-sass');
                  var path = require('path');
                  var fs = require('fs');
                  var map = require('map-stream');
                  var srcPath = 'src/';
                  var buildPath = 'build/';
                  var buildSrcPath = path.join(buildPath, 'target');
                  
                  gulp.task('processComponents', function () {
                      return gulp.src([srcPath + '/components/**/*.html'])
                          .pipe(map(function (file, cb) {
                              var injectString = '<!-- inject{scss} -->';
                              // convert file buffer into a string
                              var contents = file.contents.toString();
                              if (contents.indexOf(injectString) >= 0) {
                                  //Getting scss
                                  var scssFile = file.path.replace(/.html$/i, '.scss');
                                  fs.readFile(scssFile, function (err, data) {
                                      if (!err && data) {
                                          nodeSass.render({
                                              data: data.toString(),
                                              includePaths: [path.join(srcPath, 'style/')],
                                              outputStyle: 'compressed'
                                          }, function (err, compiledScss) {
                                              if (!err && compiledScss) {
                                                  file.contents = new Buffer(contents.replace(injectString, compiledScss.css.toString()), 'binary');
                                              }
                                              return cb(null, file);
                                          });
                                      }
                                      return cb(null, file);
                                  });
                              } else {
                                  // continue
                                  return cb(null, file);
                              }
                          }))
                          .pipe(gulp.dest(path.join(buildSrcPath, 'components')));
                  });
                  

                  結(jié)果:

                  <dom-module id="app-view">
                      <template>
                          <style>
                              :host{margin-top:50px;justify-content:center;display:flex}#container{font-size:12px}#container h1{font-size:20px}
                          </style>
                      </template>
                  </dom-module>
                  

                  這篇關(guān)于如何在 Polymer 組件中使用 Sass的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Stylesheet not loaded because of MIME-type(由于 MIME 類型而未加載樣式表)
                  CSS3 Transition ( Vendor Prefixes) crashes Safari immediately(CSS3 過渡(供應(yīng)商前綴)立即使 Safari 崩潰)
                  @font-face crashes IE8(@font-face 讓 IE8 崩潰)
                  jquery limit text by length(jquery按長度限制文本)
                  Floated Child Elements: overflow:hidden or clear:both?(浮動(dòng)子元素:溢出:隱藏或清除:兩者?)
                  How to tell Gulp to skip or ignore some files in gulp.src([...])?(如何告訴 Gulp 跳過或忽略 gulp.src([...]) 中的某些文件?)
                • <i id='8onS8'><tr id='8onS8'><dt id='8onS8'><q id='8onS8'><span id='8onS8'><b id='8onS8'><form id='8onS8'><ins id='8onS8'></ins><ul id='8onS8'></ul><sub id='8onS8'></sub></form><legend id='8onS8'></legend><bdo id='8onS8'><pre id='8onS8'><center id='8onS8'></center></pre></bdo></b><th id='8onS8'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8onS8'><tfoot id='8onS8'></tfoot><dl id='8onS8'><fieldset id='8onS8'></fieldset></dl></div>

                          <tbody id='8onS8'></tbody>
                        <legend id='8onS8'><style id='8onS8'><dir id='8onS8'><q id='8onS8'></q></dir></style></legend>

                        1. <tfoot id='8onS8'></tfoot>
                            <bdo id='8onS8'></bdo><ul id='8onS8'></ul>

                            <small id='8onS8'></small><noframes id='8onS8'>

                            主站蜘蛛池模板: 久综合 | 久久精品久久久久久久 | 天天躁日日躁狠狠躁伊人 | 亚洲天堂男人天堂 | 成人高清在线 | 日韩精品久久久久久久酒店 | 国产精品伦理一区 | 久久性色| 一级黄色片在线观看 | 在线播放日韩 | 青草国产| 日韩中文字幕在线观看 | 黄色片视频在线观看 | 国产精品一级二级 | 国产精品久久久久久无人区 | 国产性hd | 免费看a级片 | 日韩av在线一区 | 男人的天堂亚洲 | 中文字幕丰满人伦在线 | 成人精品免费视频 | 自拍视频一区 | 欧美一区二区三区的 | 韩国精品一区二区 | 九九热精品视频 | 成人精品影院 | 嫩草视频在线观看 | 精品蜜桃一区二区三区 | 日日干天天操 | 成人精品免费 | 精品一区二区在线播放 | 成人激情综合网 | 国产一区精品在线 | 黄色成人小视频 | 日本中文字幕一区 | 国产超级av | 999在线视频 | 少妇一级毛片 | 欧美视频在线观看免费 | 亚洲欧美日韩国产精品 | 日本精品国产 |