Home > 8 > How can I add 'text/jsx' type to a script tag via libraries.yml?

How can I add 'text/jsx' type to a script tag via libraries.yml?

November 7Hits:8
Advertisement

I want to add some react js files to a theme's libraries.yml and I don't know how I can do this in drupal 8.

<script type="text/babel" src="scripts/example.js"></script> or <script type="text/jsx" src="scripts/example.js"></script>

I can't figure it out hot to make the type="text/jsx" appear when the file is added to the page.

Any ideas on how I can achieve this in Drupal 8?

Answers

I took a wild guess because I couldn't find absolutely nothing. Apparently this works:

my-libary:
  version: 1.x
  js:
    js/node.js: { attributes: {type: text/babel} }

Tags:libraries

Related Articles

  • How can I add 'text/jsx' type to a script tag via libraries.yml?November 7

    I want to add some react js files to a theme's libraries.yml and I don't know how I can do this in drupal 8. <script type="text/babel" src="scripts/example.js"></script> or <script type="text/jsx" src="scr

  • Add new button to a column with "single line of text data type" in SharePointMay 21

    I am trying to create a "Add new" button to a column called "other Passengers" which has a "Single line of text data type". Such that I can add up "0 to n" numbers of passengers not in our LDAP i.e list of contact d

  • Add text to Text Widget using JavascriptJanuary 12

    Wordpress has a Text Widget (at least the theme I'm using does, and I think they all do?) In this widget I can add text or HTML. If I add HTML I can include JavaScript. This works fine (I'm hosting my own site). I want to add some text to the Widget

  • Add custom post types stats to a custom dashboard widget

    Add custom post types stats to a custom dashboard widgetMay 18

    I have a lot of custom post types and I have them showing in my "Right Now" Dashboard but it's gotten pretty long so I want to separate them to a custom widget within the dash. See example below: So my question is how do I add the CPTs to a cust

  • How to add a MIME type with a project created in Quickly?May 30

    I've built an application I want to release however I would like the files to open with the application. I have modified the .desktop file accordingly, however quickly seems to have no option for MIME files and I don't have a clue how to add them. (A

  • How to add text/caption to a line/arrow in PowerPoint 2010?December 8

    I was able in the past to double click on a PowerPoint arrow/line in order to add a caption to the line. This is not working in PP 2010. Anyone knows a way to add text to a line ? (without creating a group with a text box and a line) PS: I'm not tota

  • How can I add text and images (for example, a signature) to a PDF?December 13

    On occasion I receive forms to fill in as PDFs intended for printing (these are not true PDF forms, they do not contain fields). I would like to type onto them, and perhaps add a scanned copy of my signature. This way I could just email them back. Is

  • A Way to Add Text Before Your Hyperlink in Google Spreadsheets?March 21

    Is there a way to add text before the hyperlink? So for example: This section needs reworking. You can find the section HERE. HERE would be the text replacement for the actual link. The actual text would read like this. This section needs reworking.

  • Add custom post type items from frontendNovember 3

    I am trying to figure out on how do I make my wordpress website to be able to add portfolio items from the frontend. Plugins such as WP-User-Frontend allows posting from frontend but only works with blog posts. Is there any ways or any plugins simila

  • How to add text over Slideshow/carousel?January 23

    I've been able to create a simple slideshow using field slideshow, jcarousel and libraries. But how would I go about add text in the rhs of the images? I would like the text to change depending on the slideshow image. --------------Solutions---------

  • How can I add text on top of slideshow? March 11

    I would like to add text on top of the slide show of the following theme: http://themeforest.net/item/newcastle-a-woocommerce-powered-wordpress-theme/full_screen_preview/3887883 The home page is a specific template and writing on the home page templa

  • Can I add text to a form file upload field?

    Can I add text to a form file upload field?December 20

    Is it possible to add text/markup to a file upload field similar to the image below? I thought that something like $form['actions']['edit-field-upload']['#prefix'] = 'First'; in a hook_form_alter would work, but don't see anything. --------------Solu

  • Simple program to edit screenshots (add texts and arrows, mark stuff) on Linux

    Simple program to edit screenshots (add texts and arrows, mark stuff) on LinuxApril 8

    I have quite often the need to take screenshots and do the following: Crop them Add texts (where I want to be able to choose the color) Add arrows (where I want to be able to choose the color) Mark stuff with rectangles / ellipses (where I want to be

  • WPAlchemy - Multiple TinyMCE editor blank (can't add text)June 12

    Setup a basic WPAlchemy repeater field with a TinyMCE textbox inside. If repeated I am unable to select the new textbox and add text. If I remove TinyMCE it works fine however. Please help. functions.php: // Tiny mce metaboxes add_action('admin_print

  • How to create a custom field type which is inherited the "Text" field typeJuly 9

    I am using sharepoint 2010. I would like to create a custom field type in Visual Studio which is inherited the "Text" field type. I never created a custom field type. Can someone tell me how to do this? --------------Solutions------------- You c

  • Validate a Single line of text column type of list in sharepoint 2010 to accept only alphabets?

    Validate a Single line of text column type of list in sharepoint 2010 to accept only alphabets?August 28

    How to validate a Single line of text column type of list in SharePoint 2010 to enter accept only alphabets? no special character and no number should be allowed in that field. --------------Solutions------------- Probably one of the best ways to app

  • How do I add text to my draw.io doc?December 9

    I don't know how to add text. Please help, I know there is a button that says "text" on it yet there is know way too add a text bubble. --------------Solutions------------- You can type text into every single shape. Just select one on your diagr

  • How do I add a content-type header to my template?February 28

    I am trying to build out an api template inside our CMS to expose a particular channel as json. I'm going to call that channel "public." Here's the template that I have put together thus far: [ {exp:channel:entries channel="public" dyn

  • How to add text and a more correct zigzag-line to a figure?

    How to add text and a more correct zigzag-line to a figure?April 28

    I have now spend hours by creating this figure - without luck. I have tried different types of tikz, pstricks and multido usepackages. My biggest problem is to add text, to add a more correct zigzag line and to add the two dashed lines. My code look

  • Is it possible to add text and numbers into the same column/field of attributes of a shapefile in ArcGIS 10.3?May 22

    I have to add a field to the attributes of a shapefile and the data reads as: 2 BDL 22 18 11 BDL BDL 25 3 Could these data be added to the same field/column of the attributes of the shapefile in arcmap 10.3? --------------Solutions------------- To co

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 17 q. 0.931 s.