Code Monkey home page Code Monkey logo

Comments (6)

athikrishnan avatar athikrishnan commented on August 15, 2024

i am not a user of webpack, but i think the best way to go about it is to copy (i am using gulp) the css file to your public/asset folder.

from keen-ui.

JosephusPaye avatar JosephusPaye commented on August 15, 2024

Yeah, what @athikrishnan said. Also, if you're using a preprocessor like Stylus, you can import the CSS file like so:

@import '~keen-ui/dist/keen-ui.css';

from keen-ui.

murbanowicz avatar murbanowicz commented on August 15, 2024

Thanks.

from keen-ui.

nicooprat avatar nicooprat commented on August 15, 2024

I got it working by using import 'keen-ui/dist/keen-ui.css' with Webpack (using the official template) in main.js:

import Vue from 'vue'
import Keen from 'keen-ui'
import 'keen-ui/dist/keen-ui.css'

Vue.use(Keen)

However, styles aren't applied because they don't match. CSS is using class names, HTML is using custom tags:

.ui-alert {
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  ...
}
<ui-alert type="warning">
  Ay caramba! Alerts can also contain HTML. <a href="https://google.com" target="_blank">Click here</a> for Google.com.
</ui-alert>

What am I missing?

from keen-ui.

nicooprat avatar nicooprat commented on August 15, 2024

Answering to myself, this works (notice the : before the attribute):

<ui-alert :type="warning">
  Ay caramba! Alerts can also contain HTML. <a href="https://google.com" target="_blank">Click here</a> for Google.com.
</ui-alert>

The output HTML becomes:

<div class="ui-alert" _v-10f2d0f9="">
    <div class="ui-alert-body ui-alert-toggle-transition info" role="alert">
        ....
    </div>
</div>

I guess it's the expected behavior!

Edit: actually, it's working when saving (with webpack hot reload: <div class="ui-alert">), but if I reload the page, the styles disappear (HTML looks like <ui-alert type="warning">). Weird... Any idea?

Edit 2: It seems that each component must import Keen UI elements:

<template>
  <div id="app">
    <ui-toolbar title="Inbox">
      <div slot="actions">
        <ui-icon-button type="clear" color="black" icon="arrow_back"></ui-icon-button>
        <ui-icon-button type="clear" color="black" icon="star_border"></ui-icon-button>
      </div>
    </ui-toolbar>
  </div>
</template>

<script>
import Keen from 'keen-ui'

const App = Vue.extend({
  components: {
    Keen.UiToolbar,
    Keen.UiIconButton
  },
  ...
})
</script>

In this configuration, no more need to import CSS (remove this line: import 'keen-ui/dist/keen-ui.css').

from keen-ui.

nicooprat avatar nicooprat commented on August 15, 2024

Solved by following #29

from keen-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.