Code Monkey home page Code Monkey logo

Comments (9)

eavichay avatar eavichay commented on May 27, 2024

Hey,
if / switch-case / repeat, are OPTIONAL, therefore if you require using them, you should import these also.
https://unpkg.com/[email protected]//directives/if.js
https://unpkg.com/[email protected]//directives/repeat.js
https://unpkg.com/[email protected]/directives/switch-case.js

from slim.js.

eavichay avatar eavichay commented on May 27, 2024

Or use all of them at once
https://unpkg.com/browse/[email protected]/directives/all.js

from slim.js.

eavichay avatar eavichay commented on May 27, 2024

Please let me know if that works, so I could close this issue.

from slim.js.

JamieVaughn avatar JamieVaughn commented on May 27, 2024

Thank you for the tip! I am having trouble implementing it though in an es6 module script. I'm not sure the proper syntax for the directive import, since I couldn't find the export names for the directives. I tried this but that didn't seem to work:

<script type="module">
        import {Slim} from 'https://unpkg.com/[email protected]/Slim.js';
        import 'https://unpkg.com/browse/[email protected]/directives/all.js';

</script>

my other thought was to do something like import { if, switch, repeat } from 'https://unpkg.com/browse/[email protected]/directives/all.js'; But that didn't work either

from slim.js.

eavichay avatar eavichay commented on May 27, 2024

Remove the 'browse' from the URL.

import { Slim } from "https://unpkg.com/[email protected]/Slim.js";
import "https://unpkg.com/[email protected]/directives/if.js";

from slim.js.

eavichay avatar eavichay commented on May 27, 2024

FYI if you import slim from a local node-module, you should also import the directives from the same module.

from slim.js.

JamieVaughn avatar JamieVaughn commented on May 27, 2024

Oops, I should have caught that 'browse' thing... anyways that fixed it and it works now. Thanks vary much for the assistance and for a nice minimalist web-components library!

from slim.js.

eavichay avatar eavichay commented on May 27, 2024

You might want to try one of my two other libraries. There is an even lighter library @neow/web (alpha) it is much faster, fully expressional but lacks repeat directive (but you can add your own).

Also another one, ottavino is an object based one, that can "convert" regular HTML elements into custom-elements behavior.

https://github.com/neo-web/neow - https://webcomponents.dev/edit/fEa6HG5aeEwJ75vqDVyj
https://github.com/betterthancode/ottavino - https://webcomponents.dev/edit/RA7SjhwlA7S18lZy9kkL

I would appreciate your feedback.

from slim.js.

JamieVaughn avatar JamieVaughn commented on May 27, 2024

Cool, both of those look really nice. I'll use them in the same project I'm doing that I used Slim for. and I let you know how it goes! Thanks!

from slim.js.

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.