seajs-css less 加载_html/css_WEB-ITnose
程序员文章站
2022-05-21 11:32:35
...
(function(){ /** * util-request.js - The utilities for requesting script and style files * ref: tests/research/load-js-css/test.html */ function isType(type) { return function(obj) { return {}.toString.call(obj) == "[object " + type + "]" } } var isString = isType("String") var doc = document var head = doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement var baseElement = head.getElementsByTagName("base")[0] var IS_CSS_RE = /\.css(?:\?|$)/i var IS_LESS_RE = /\.less(?:\?|$)/i var currentlyAddingScript var interactiveScript// `onload` event is not supported in WebKit "a/b/"// ref: http://jsperf.com/regex-vs-split/2 function dirname(path) { return path.match(DIRNAME_RE)[0] }// Canonicalize a path// realpath("http://test.com/a//./b/../c") ==> "http://test.com/a/c" function realpath(path) { // /a/b/./c/./d ==> /a/b/c/d path = path.replace(DOT_RE, "/") /* @author wh1100717 a//b/c ==> a/b/c a///b/////c ==> a/b/c DOUBLE_DOT_RE matches a/b/c//../d path correctly only if replace // with / first */ path = path.replace(MULTI_SLASH_RE, "$1/") // a/b/c/../../d ==> a/b/../d ==> a/d while (path.match(DOUBLE_DOT_RE)) { path = path.replace(DOUBLE_DOT_RE, "/") } return path }// Normalize an id// normalize("path/to/a") ==> "path/to/a.js"// NOTICE: substring is faster than negative slice and RegExp function normalize(path) { var last = path.length - 1 var lastC = path.charAt(last) // If the uri ends with `#`, just return it without '#' if (lastC === "#") { return path.substring(0, last) } return (path.substring(last - 2) === ".js" || path.indexOf("?") > 0 || path.substring(last - 3) === ".css" || path.substring(last - 4) === ".less" || lastC === "/") ? path : path + ".js" } var PATHS_RE = /^([^/:]+)(\/.+)$/ var VARS_RE = /{([^{]+)}/g function parseAlias(id) { var alias = data.alias return alias && isString(alias[id]) ? alias[id] : id } function parsePaths(id) { var paths = data.paths var m if (paths && (m = id.match(PATHS_RE)) && isString(paths[m[1]])) { id = paths[m[1]] + m[2] } return id } function parseVars(id) { var vars = data.vars if (vars && id.indexOf("{") > -1) { id = id.replace(VARS_RE, function(m, key) { return isString(vars[key]) ? vars[key] : m }) } return id } function parseMap(uri) { var map = data.map var ret = uri if (map) { for (var i = 0, len = map.length; i
上一篇: ps制作简单的动态闪字效果图
推荐阅读
-
requireJS在同一个HTML/JSP页面,加载不同版本的jquery_html/css_WEB-ITnose
-
如何使用SVG生成超酷的页面预加载素描动画效果_html/css_WEB-ITnose
-
模拟实现ajax加载框_html/css_WEB-ITnose
-
Bootstrap定制(二)less基础语法_html/css_WEB-ITnose
-
css扩展技术:Less和Sass的区别_html/css_WEB-ITnose
-
CSS3动画实现loading加载图标_html/css_WEB-ITnose
-
(十) ng-inlude指令加载页面失败的原因和解决方法_html/css_WEB-ITnose
-
编写的jsp页面,为什么IE网页上不能显示加载的图片?_html/css_WEB-ITnose
-
seajs-css less 加载_html/css_WEB-ITnose
-
白屏问题与FOUC无样式内容闪烁/加载异步_html/css_WEB-ITnose