buberdds / angular-bootstrap-colorpicker

Native AngularJS colorpicker directive. No dependency on jQuery or jQuery plugin is required.
MIT License
419 stars 226 forks source link

less variables not overridable #21

Closed JumpLink closed 10 years ago

JumpLink commented 10 years ago

please make less variables overridable. In my project I have include your less files in this way:

@import "../../bower_components/angular-bootstrap-colorpicker/less/variables.less";
@ColorPickerImagePath: "bower_components/angular-bootstrap-colorpicker/img";
@import "../../bower_components/angular-bootstrap-colorpicker/less/colorpicker.less";

but the @ColorPickerImagePath is not overridable because you are including the variables.less file insite the colorpicker.less file.

JumpLink commented 10 years ago

Okay now I've seen that you are using base64-strings (but why you are using the image path in the less file, you are using any tool to generate the base64 string?), so I've solved my issue in this way:

@import "../../bower_components/angular-bootstrap-colorpicker/less/variables.less";
@ColorPickerImagePath: "/bower_components/angular-bootstrap-colorpicker/img";
@import "../../bower_components/angular-bootstrap-colorpicker/less/colorpicker.less";
.colorpicker-saturation {
  background-image: url('@{ColorPickerImagePath}/saturation.png');
}
.colorpicker-hue {
  background-image: url('@{ColorPickerImagePath}/hue.png');
}
.colorpicker-alpha,
.colorpicker-color {
  background-image: url('@{ColorPickerImagePath}/alpha.png');
}
buberdds commented 10 years ago

Hi,

the file was created in the PR #6 4 months ago. Now in my opinion the variable.less is completly useless, since images are converted to base64 strings. I don't know if there is a need to customize image sources.

JumpLink commented 10 years ago

All right, but you need to add the base64-string to the less file, too.

Edit: Oh sorry, I did not know data-uri

buberdds commented 10 years ago

Yes, the data-uri landed in the LESS 1.4. Anyway, thanks for pointing out this problem. The idea of the variable.less file is not good anymore. btw you can always

@import

a compiled colorpicker.css in your less file.

JumpLink commented 10 years ago

@buberdds thanks for the tip!