vue-custom-properties
Version:
Make easier to use CSS custom properties in Vue components
10 lines • 835 B
JavaScript
/*!
* vue-custom-properties v0.1.0
* https://github.com/ktsn/vue-custom-properties
*
* @license
* Copyright (c) 2017 katashin
* Released under the MIT license
* https://github.com/ktsn/vue-custom-properties/blob/master/LICENSE
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.VueCustomProperties=t()}(this,function(){"use strict";function e(e){n(!o,"Already installed"),(o=e).mixin({mounted:t})}function t(){var e=this,t=this.$options.customProperties||{};Object.keys(t).forEach(function(n){var o=t[n];e.$watch(o,function(t){var o=e.$el.style;o&&o.setProperty(n,t)},{immediate:!0})})}function n(e,t){if(!e)throw new Error("[vue-custom-properties] "+t)}var o;return"undefined"!=typeof window&&window.Vue&&window.Vue.use(e),{install:e}});