mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Add import inline option. Fixes #1209
This commit is contained in:
@@ -20,8 +20,8 @@ tree.Import = function (path, features, options, index, currentFileInfo) {
|
||||
this.features = features;
|
||||
this.currentFileInfo = currentFileInfo;
|
||||
|
||||
if (this.options.less !== undefined) {
|
||||
this.css = !this.options.less;
|
||||
if (this.options.less !== undefined || this.options.inline) {
|
||||
this.css = !this.options.less || this.options.inline;
|
||||
} else {
|
||||
var pathValue = this.getPath();
|
||||
if (pathValue && /css([\?;].*)?$/.test(pathValue)) {
|
||||
@@ -44,7 +44,9 @@ tree.Import.prototype = {
|
||||
accept: function (visitor) {
|
||||
this.features = visitor.visit(this.features);
|
||||
this.path = visitor.visit(this.path);
|
||||
this.root = visitor.visit(this.root);
|
||||
if (!this.options.inline) {
|
||||
this.root = visitor.visit(this.root);
|
||||
}
|
||||
},
|
||||
toCSS: function (env) {
|
||||
var features = this.features ? ' ' + this.features.toCSS(env) : '';
|
||||
@@ -84,7 +86,10 @@ tree.Import.prototype = {
|
||||
|
||||
if (this.skip) { return []; }
|
||||
|
||||
if (this.css) {
|
||||
if (this.options.inline) {
|
||||
var contents = new(tree.Anonymous)(this.root);
|
||||
return this.features ? new(tree.Media)([contents], this.features.value) : [contents];
|
||||
} else if (this.css) {
|
||||
var newImport = new(tree.Import)(this.evalPath(env), features, this.options, this.index);
|
||||
if (!newImport.css && this.error) {
|
||||
throw this.error;
|
||||
|
||||
Reference in New Issue
Block a user