匹配scss内嵌代码：@import 'xxx'; @import 'xxx', 'xxx';
333887
function _process( content ) {
    var reg = /((?:\/\/.*?\n)|(?:\/\*[\s\S]*?\*\/))|(?:@import\s([\s\S]*?)(?:\n|$)(?!\s+[^{@]*\n))/ig;
    // var reg = /@import[\s\S]*?;/ig;
    var rUrl = /^url/i;
    var rEnd = /;$/;

    content = fixLineBreak( content );

    return content.replace( reg, function( all, comments, value ) {
        var files;

        value = value ? value.trim().replace( rEnd, '' ) : '';

        // If it's comments or If the @import has any media queries.
        if ( comments || /('|").*?\1\s+[^'"]+$/.exec(value) ) {
            return all;
        }

        files = value.split(/\s*,?\s+/m).map(function( value ) {
            var quote = '',
                match;

            value = value.trim();
            match = /^('|")(.*)\1$/.exec( value );

            if ( match ) {
                value = match[ 2 ];
                quote = match[ 1 ];
            }

            // If the file’s extension is .css.
            if ( /\.css$/i.exec( value ) ||

                // If the filename begins with http://.
                /^http/i.exec( value ) ||

                // If the filename is a url().
                /^url/i.exec( value ) ) {
                return '@import ' + quote + value + quote + ';';
            }

            return map.wrap( value );
        });

        return files.join('\n');
    });
}
959588
function (runtime, name, fn, config) {
            name = indexMapStr(name);

            var mods = runtime.Env.mods,
                mod = mods[name];

            if (mod && mod.fn) {
                S.log(name + ' is defined more than once', 'warn');
                return;
            }

            // 没有 use，静态载入的 add 可能执行
            Utils.createModuleInfo(runtime, name);

            mod = mods[name];

            // 注意：通过 S.add(name[, fn[, config]]) 注册的代码，无论是页面中的代码，
            // 还是 js 文件里的代码，add 执行时，都意味着该模块已经 LOADED
            S.mix(mod, {
                name: name,
                status: LOADED,
                fn: fn
            });

            S.mix(mod, config);
        }
714440
function generateComponent(name, options) {
  const config = Config(options);

  let className = utils.nameToKey(name);
  let fileBase = path.join(config.srcDir, 'components', className, className);

  mkdirp.sync(path.dirname(fileBase));

  ['.js', '.xml', (options.scss ? '.scss' : '.less'), '.test.js'].forEach((ext) => {
    let target = fileBase + ext;
    if (utils.isFile(target)) {
      console.error(`组件创建失败："${path.relative(config.workDir, target)}" 已经存在`.red);
      process.exit();
    }
    utils.copyAndReplace(path.join(__dirname, '../templates/component/component' + ext), target, {
      COMPONENT_NAME: name,
      CLASS_NAME: className
    });
  });
}
7034
function _injectRootClass(selector, rootClass) {
  // 如果是page开头的选择器则注入到page之后，否则注入到开头
  if (selector.startsWith('page ')) {
    return selector.replace('page', `page .${rootClass}`);
  } else {
    return `.${rootClass} ${selector}`;
  }
}
403659
function buildCSS(src, filename, dest, applyHeader) {
  dest = dest || config.dist.cssPath;
  applyHeader = applyHeader || false;

  return gulp.src(src)
    .pipe(sass({
      includePaths: [config.src.scssPath, config.packagesPath]
    })
      .on('error', sass.logError))
    .pipe(cleanCSS())
    .pipe(autoprefixer({
      // Supported browsers added in package.json ("browserslist")
      cascade: false
    }))
    .pipe(gulpif(applyHeader, header(config.prj.header, {
      config: config
    })))
    // Remove charset rule (if present) and add to the first
    // line of the stylesheet (@charset must be on the first line)
    .pipe(replace('@charset "UTF-8";', ''))
    .pipe(header('@charset "UTF-8";\n'))
    .pipe(rename(filename))
    .pipe(gulp.dest(dest));
}
1021324
def compile_scss_normal
        Dir["#{@path}.scss"].select { |f| File.file? f }.each do |file|
          next if File.basename(file).chr == '_'
          scss_file = File.open(file, 'rb') { |f| f.read }

          output_file = File.open( file.split('.').reverse.drop(1).reverse.join('.'), "w" )
          output_file << Sass::Engine.new(scss_file, { syntax: :scss, quiet: true, style: :compressed }).render
          output_file.close
        end
      end
119071
function () {
            var _this = this;

            /* 滚动拉取图片 */
            domUtils.on($G('imageList'), 'scroll', function(e){
                var panel = this;
                if (panel.scrollHeight - (panel.offsetHeight + panel.scrollTop) < 10) {
                    _this.getImageData();
                }
            });
            /* 选中图片 */
            domUtils.on(this.container, 'click', function (e) {
                var target = e.target || e.srcElement,
                    li = target.parentNode;

                if (li.tagName.toLowerCase() == 'li') {
                    if (domUtils.hasClass(li, 'selected')) {
                        domUtils.removeClasses(li, 'selected');
                    } else {
                        domUtils.addClass(li, 'selected');
                    }
                }
            });
        }
323830
function(ctx, frame, cb) {
                // ... 如果是 .render(function () {})
                if (typeof ctx === 'function') {
                    cb = ctx;
                    ctx = {};
                } 
                // ...? 什么场景使用了frame
                else if (typeof frame === 'function') {
                    cb = frame;
                    frame = null;
                }

                return lib.withPrettyErrors(this.path, this.env.dev, function() {
                    // debugger;
                    this.compile();

                    // ... 当前作用域不是简单的Object对象，是Context类的实例，并且整合了blocks对象
                    // ...todo 整合了blocks对象的情景分析
                    var context = new Context(ctx || {}, this.blocks);
                    var syncResult = null;

                    frame = frame || new Frame()

                    this.rootRenderFunc(this.env, context, frame, runtime, cb || function(err, res) {
                        if (err) {
                            throw err;
                        }
                        syncResult = res;
                    });

                    return syncResult;
                }.bind(this));
            }
852892
function compile(options) {
    options = options || {};
    var fs = require('fs');
    var content = fs.readFileSync(options.indexFile || INDEX_FILE, 'utf8');
    // 插入同步数据的注入点
    content = content.replace('</head>', '<script>window.__rebas__ = ${rebas}</script>\n</head>');

    var etpl = require('etpl');
    etpl = new etpl.Engine({defaultFilter: 'raw'});
    return etpl.compile(content);
}
1015241
def to_css(self):
        
        # TODO should this include the traceback?  any security concerns?
        prefix = self.format_prefix()
        original_error = self.format_original_error()
        sass_stack = self.format_sass_stack()

        message = prefix + "\n" + sass_stack + original_error

        # Super simple escaping: only quotes and newlines are illegal in css
        # strings
        message = message.replace('\\', '\\\\')
        message = message.replace('"', '\\"')
        # use the maximum six digits here so it doesn't eat any following
        # characters that happen to look like hex
        message = message.replace('\n', '\\00000A')

        return BROWSER_ERROR_TEMPLATE.format('"' + message + '"')
574121
function () {
        const editor = this.editor
        const $textElem = editor.$textElem

        $textElem.on('keydown', e => {
            if (e.keyCode !== 8) {
                return
            }
            const txtHtml = $textElem.html().toLowerCase().trim()
            if (txtHtml === '<p><br></p>') {
                // 最后剩下一个空行，就不再删除了
                e.preventDefault()
                return
            }
        })

        $textElem.on('keyup', e => {
            if (e.keyCode !== 8) {
                return
            }
            let $p
            const txtHtml = $textElem.html().toLowerCase().trim()

            // firefox 时用 txtHtml === '<br>' 判断，其他用 !txtHtml 判断
            if (!txtHtml || txtHtml === '<br>') {
                // 内容空了
                $p = $('<p><br/></p>')
                $textElem.html('') // 一定要先清空，否则在 firefox 下有问题
                $textElem.append($p)
                editor.selection.createRangeByElem($p, false, true)
                editor.selection.restoreSelection()
            }
        })

    }
1038544
public function init()
    {
        // 缓存实例代码是否设置
        if (!empty($this->cacheInstanceString)) {
            $cache = str_eval($this->cacheInstanceString);
            if (isset($cache) && $cache instanceof Store) {
                $this->cache = $cache;
            }
        }

        // urlRule 预处理
        if (null === $this->cache) {
            $this->_rules = $this->parseUrlRule();
        } else if (null !== ($rules = $this->cache->get(self::CACHE_KEY))) {
            $this->_rules = $rules;
        } else {
            $this->_rules = $this->parseUrlRule();
            $this->cache->set(self::CACHE_KEY, $this->_rules);
        }
    }
64034
function addVueSupport(env, webpackConfig) {
    // 找出内置的 babel-loader
    var babelLoader = webpackConfig.module.rules.filter(function(rule) {
        return rule.loader == 'babel-loader'
    })[0];

    // 找出内置的 css 文件关联的 rule, 这样做的好处是共用内置的配置
    var cssRule = webpackConfig.module.rules.filter(function(rule) {
        return rule.test.test('.css');
    })[0];
    // 找出内置的 css-loader, 这样便于共用配置
    var cssLoader = cssRule.use.filter(function(loader) {
        return loader.loader == 'css-loader';
    })[0];

    // 为了样式支持 HMR, 在开发环境下只使用 style-loader
    // XXX 目前发现 async import 即动态导入的模块 HMR 没有生效,
    // 即开启 HMR 的时候, 修改 async-component.vue 确实会重载模块, 但界面上没有效果
    var vueCssLoader = env.__mode__ == 'dev' ? [{
        loader: 'vue-style-loader'
    }, cssLoader] : ExtractTextPlugin.extract({
        fallback: 'vue-style-loader',
        use: [cssLoader]
    });

    // 添加 vue-loader 配置
    webpackConfig.module.rules.push({
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
            loaders: {
                // 需要在这里设置 babel-loader, 否则 ES2015 的语法不会转义,
                // 除非你统一使用了 .babelrc 配置文件
                js: [babelLoader],
                // 由于 vue-loader 默认的 extractCSS 配置没有对 css-loader 添加 importLoaders 设置,
                // 这会造成 @import 进去的样式没有经过 postcss-loader 的处理,
                // 所以我们需要自己来设置 css 的 loader 处理
                //
                // 但是不能在 options.loaders.css 中配置 postcss-loader
                // 否则会报错
                // Module build failed: TypeError: Cannot read property 'postcss' of null
                // 应该在 options.postcss 中配置
                // 不过为了统一 webpack 的配置, 我们使用共用的 postcss.config.js 来配置
                css: vueCssLoader
            }
        }
    });

    // 如果你不使用 Vue 的模板功能, 则可以直接使用默认的 vue.runtime 版
    // if (env.__mode__ == 'dev') {
    //     webpackConfig.resolve.alias['vue$'] = 'vue/dist/vue.js';
    // } else {
    //     webpackConfig.resolve.alias['vue$'] = 'vue/dist/vue.min.js';
    // }
}
465824
function getHtmlContent(jQuery, fileArr, urlFunc, scriptAttr) {
    var $ = jQuery,
        jsArr = [],
        cssArr = [];

    // 获得js和css文件数组
    fileArr.forEach(function (item) {
        var extName = path.extname(item.filePathInHtml);
        switch (extName) {
            case '.js':
                jsArr.push(item);
                break;
            case '.css':
                cssArr.push(item);
                break;
            default :
                break;
        }
    });

    //处理JS
    if (jsArr.length) {
        var scriptDomArr = $('script[' + scriptAttr + ']');

        scriptDomArr.each(function () {
            var scriptDom = $(this),
                scriptUrl = scriptDom.attr(scriptAttr);

            if (!util.isExternalUrl(scriptUrl)) {
                for (var i = 0, length = jsArr.length; i < length; i++) {
                    var one = jsArr[i];

                    if (util.isMatch(scriptUrl, one.filePathInHtml)) {
                        urlFunc(scriptDom, scriptUrl, one, scriptAttr);

                        if (scriptAttr === "data-main") {
                            dataMainUrl = scriptUrl;
                        }

                        break;
                    }
                }
            }
        });

    }

    //处理CSS
    if (cssArr.length) {
        var cssDomArr = $('link[rel="stylesheet"][href]');

        cssDomArr.each(function () {
            var cssDom = $(this),
                cssUrl = cssDom.attr('href');

            if (!util.isExternalUrl(cssUrl)) {
                for (var i = 0, length = cssArr.length; i < length; i++) {
                    var one = cssArr[i];

                    if (util.isMatch(cssUrl, one.filePathInHtml)) {
                        urlFunc(cssDom, cssUrl, one, 'href');
                        break;
                    }
                }
            }
        });
    }

    return $.html();
}
1166807
function ( el, propStr ) {
        var css = ( el && el.style )? el.style.cssText : '';

        //setter
        if ( $B.string.is(propStr) ) {
            propStr = $B.string.trim( propStr );

            if ( css && css.charAt( css.length-1 ) != ';' ) css += ';';//Opera에서는 css 속성끝에 ";"처리를 하지 않으면 에러가 난다.
            el.style.cssText = css + ' ' + propStr;
            //getter
        } else {
            return css;
        }
    }
1337399
function compile() {
        debug('read %s', cssPath);
        fs.readFile(stylusPath, 'utf8', function(err, str){
          if (err) return error(err);
          var style = options.compile(str, stylusPath);
          var paths = style.options._imports = [];
          imports[stylusPath] = null;
          style.render(function(err, css){
            if (err) return next(err);
            debug('render %s', stylusPath);
            imports[stylusPath] = paths;
            mkdir(dirname(cssPath), { mode: parseInt('0700', 8), recursive: true }, function(err){
              if (err) return error(err);
              fs.writeFile(cssPath, css, 'utf8', next);
            });
          });
        });
      }
637742
function kmcCss(cssFile,cssContent,combinedJSFile){
	console.log(combinedJSFile);
	var jsContent = fs.readFileSync(combinedJSFile,{encoding:'utf8'});
	// TODO:把jsContent里的requires里的对css的引用删除只剩下一个

}