I am constructing my very own theme for use with Angular 4 and might’t inform the place/why Drupal is deciding to import jQuery.
This is Drupal Developer code for my theme, loosely based mostly off this Angular 1 theme:
ng.information.yml
identify: ng sort: theme libraries: - ng/base description: 'An theme that makes Angular do all Drupal Developer work' core: 8.x
ng.libraries.yml
base: model: 8.x js: js/inline.bundle.js: {} js/polyfills.bundle.js: {} js/kinds.bundle.js: {} js/vendor.bundle.js: {} js/predominant.bundle.js: {}
ng.module
<?php operate ng_theme() { return array( 'ng_view' => array( 'template' => 'view', 'variables' => array('title' => NULL), ), ); }
ng.routing.yml
ng.view: path: 'ng' defaults: _title: 'Drupal Angular' _controller: 'DrupalngControllerDrupalNgController::viewDrupalNg' necessities: _permission: 'entry content material'
src/Controller/DrupalNgController
namespace DrupalngController; use DrupalCoreControllerControllerBase; class DrupalNgController extends ControllerBase { public operate viewDrupalNg() { $construct['myelement'] = array( '#theme' => 'ng_view', ); $construct['myelement']['#attached']['library'][] = 'ng/inline.bundle'; $construct['myelement']['#attached']['library'][] = 'ng/polyfills.bundle'; $construct['myelement']['#attached']['library'][] = 'ng/kinds.bundle'; $construct['myelement']['#attached']['library'][] = 'ng/vendor.bundle'; $construct['myelement']['#attached']['library'][] = 'ng/predominant.bundle'; return $construct; } }
templates/view.html.twig
<html{{ html_attributes }}> <head> <title>Angular app</title> <meta identify="viewport" content material="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta identify="HandheldFriendly" content material="true" /> <meta identify="apple-touch-fullscreen" content material="YES" /> </head> <physique> <app-root></app-root> </physique> </html>