Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80669 views
1
/**
2
* Copyright 2013 Facebook, Inc.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
/*jslint proto:true*/
17
18
var inherits = require('util').inherits;
19
var Resource = require('./Resource');
20
21
/**
22
* Resource for *.css files
23
* @extends {Resource}
24
* @class
25
* @param {String} path path of the resource
26
*/
27
function CSS(path) {
28
Resource.call(this, path);
29
30
this.id = null;
31
32
this.fbSprites = [];
33
this.options = {};
34
this._requiredCSSMap = {};
35
this._requiredLegacyComponentsMap = [];
36
}
37
inherits(CSS, Resource);
38
CSS.__proto__ = Resource;
39
40
41
CSS.prototype.isNopackage = false;
42
CSS.prototype.isNonblocking = false;
43
CSS.prototype.isModule = false;
44
CSS.prototype.isPermanent = false;
45
CSS.prototype.networkSize = 0;
46
CSS.prototype.type = 'CSS';
47
CSS.prototype.requiredCSS = [];
48
CSS.prototype.requiredLegacyComponents = [];
49
50
51
CSS.prototype.addRequiredLegacyComponent = function(x) {
52
this._requiredLegacyComponentsMap[x] = true;
53
};
54
55
CSS.prototype.addRequiredCSS = function(x) {
56
this._requiredCSSMap[x] = true;
57
};
58
59
CSS.prototype.finalize = function() {
60
var keys = Object.keys(this._requiredLegacyComponentsMap);
61
if (keys.length) {
62
this.requiredLegacyComponents = keys;
63
}
64
keys = Object.keys(this._requiredCSSMap);
65
if (keys.length) {
66
this.requiredCSS = keys;
67
}
68
};
69
70
71
module.exports = CSS;
72
73