美文网首页CSS more
如何不合并 CSS 文件

如何不合并 CSS 文件

作者: Transnet2014 | 来源:发表于2017-04-19 18:51 被阅读0次

返回导航

#158

I created a mini gulp module to solve this problem. But, I think that can be better, so I don't uploaded the module yet. Basically I have app.js file, and constants with array of files to load. Something like this:

angular.module('app', [ngCssInjector])
.constant('mainViewCss', ['path/to/style1.css', 'path/to/style2.css',
'path/to/style3.css'])
.constant('loginViewCss', ['path/to/style2.css', 'path/to/style4.css',
'path/to/style5.css']).etc()

Then, cause I never injected that files on index.html, I take the files from the constant values in app.js and then just uglify and copy all files.

gulp.task('copy-extra-files', function(){
  return gulp.src('src/app/app.js')
    .pipe(ngContantValues())
    .pipe(minifyCSS())
    .pipe(gulp.dest(relativeDir));
});

The project is responsible for injecting the files is in https://github.com/CristianMR/ngcssinjector

返回导航

相关文章

  • 前端的项目优化

    如何进行项目优化呢?1,文件合并 减少http请求,合并css js 文件2,文件体积压缩。利用webpack,G...

  • 网易微专业-页面架构 页面优化

    1、减少请求图片合并CSS文件合并 2、减少文件大小选择合适的格式。压缩图片。减小CSS文件大小:CSS值缩写;省...

  • 常见技术问题及答案(二)

    一.如何进行网站性能优化? (1)尽可能减少HTTP请求:图片合并 (css sprites),Js脚本文件合并、...

  • Sass

    文件后缀名 scss sass 导入 scss会被合并成一个CSS文件, css不会被合并 注释 双斜杠注释不会被...

  • 前端性能优化

    减少HTTP请求(1) (1)合并图片(css sprites)合并CSS和JS文件。 (2)图片懒加载lazyl...

  • 前端性能优化汇总

    网络优化 减少请求文件数,资源合并(雪碧图、SVG(Iconfont)、JS/CSS文件合并) 减少资源体积,资源...

  • 面试题 -- 如何对网站的文件和资源进行优化

    文件合并(减少http请求) 使用css sprites合并图片 文件压缩 目的是直接减少文件下载的体积 使用CD...

  • 一些前端开发注意的细节

    1.如何对CSS和Js进行优化CSS1.代码去重2.压缩代码量(很多在线工具)3.雪碧图压缩4.CSS文件合并 j...

  • 【面试题】性能优化相关

    【前端性能优化方式总结】 一、减少HTTP请求 1.合并文件 将css、js分别合并到一个文件中。 减少文件请求。...

  • 如何不合并 CSS 文件

    返回导航 #158 I created a mini gulp module to solve this prob...

网友评论

    本文标题:如何不合并 CSS 文件

    本文链接:https://www.haomeiwen.com/subject/dmphzttx.html