fex-team / fis3-postpackager-loader

静态资源前端加载器
BSD 2-Clause "Simplified" License
82 stars 38 forks source link

css加载顺序问题 #78

Open qianjunsteve opened 8 years ago

qianjunsteve commented 8 years ago

主页面中依赖很多插件,loader输出结果就是先加载主页面css,再加载依赖插件的css,如何颠倒顺序? 多谢。

2betop commented 6 years ago

默认应该是先加载依赖插件的 css 再加载当前页面引入的 css。

除非你配置了 <!--DEPENDENCIES_INJECT_PLACEHOLDER-->

配置了的话会在标注处开始加入依赖。

<head>
    <meta charset="UTF-8">
    <title>XXXX</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <link rel="stylesheet"
        href="font-awesome/css/font-awesome.css">
    <link rel="stylesheet"
        href="bootstrap/dist/css/bootstrap.css">
    <link rel="stylesheet"
        href="animate.css/animate.css">
    <link rel="stylesheet"
        href="highlight.js/styles/github.css">
    <!--DEPENDENCIES_INJECT_PLACEHOLDER-->
    <link rel="stylesheet" href="../pcss/renderer.pcss">
    <link rel="stylesheet" href="../pcss/editor.pcss">
    <link rel="stylesheet" href="./doc.css">
    <link rel="stylesheet" href="./style.pcss">
    <style>
        .app-wrapper {
            position: relative;
            width: 100%;
            height: 100%;
        }
    </style>
</head>

比如这个例子, 先是框架 css,然后是依赖中的 css,再然后才是自己写的 CSS