Develop your own personalized Angular schematics that produces a file that begins with an underscore

Having trouble with custom Angular schematics file naming.

I'm trying to create a theme SCSS file that starts with an underscore followed by a double underscore as a delimiter. For instance, I want the file name to be _mouse-theme.scss, using the name variable

<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fba4a4959a969ebb9f9a88939e8992819ed68f939e969ed588988888">[email protected]</a>
. However, it seems to only generate mouse-theme.scss without the leading underscore. I tried using three underscores but ended up with an undefined name variable. Is there a workaround for this issue?

Appreciate any help!

Answer №1

When you utilize the @dasherize function, it will consistently convert the filename to the dasherized-file-name-format.

Nonetheless, if you decide to name your file in a format such as __fileName__-theme.scss, then you have the option to execute:

_options.fileName = '_' + dasherize(_options.name);

within your schematic procedure, resulting in both the dasherized filename and a prefix of _.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there an undocumented property lurking in the depths of the Webpack server

The document specifies that Options that work with webpack-dev-middleware will have a key symbol next to them. I couldn't find any information on "cookieDomainRewrite" but when I tried using it, it worked. Any insights? Or suggestions on how I ...

Manipulating Angular and Typescript to utilize the method's parameter value as a JavaScript object's value

I am currently working with Ionic, Angular, and Typescript, attempting to dynamically set the value of a location based on the parameter passed from a method. Here is the relevant code snippet: async fileWrite(location) { try { const result = a ...

When trying to click a button in an ion-footer, the (click) function may not execute initially

I have been working on creating a chat feature with Ionic 2, utilizing the keyboard-attach directive. //View <ion-footer [keyboardAttach]="content"> <ion-toolbar class="text_send"> <ion-textarea class="textarea" fz-elastic ...

Generating a three-level unordered list using arrays and for-loops in JavaScript/JSON

Are there more efficient ways to achieve the desired results from this JSON data? Can someone assist me in understanding why it is working and if it can be optimized for cleanliness? <div id="accordion" class="display-data"> ...

What are the best techniques for distinguishing the selected selector in jQuery?

$('#select_id1, #select_id2, #select_id3').change(function() { // Depending on which select element has changed, 'str' should be set accordingly. // For '#select_id1', 'str' should be equal to 'select_id ...

Discover Vue3's efficient event handling feature that allows you to easily listen to events from dynamically generated child components

I am dynamically creating a Vue component and need to listen to the event it emits. While I know that you can use @eventName in the markup, my component is being created using createApp. const div = document.createElement('div'); this.$refs.logi ...

Imitate a HTTP request

Currently, I am working on developing a front-end application using Angular (although not crucial to this question). I have a service set up that currently supplies hard-coded JSON data. import { Injectable } from '@angular/core'; import { Obser ...

The clone() function in jQuery causes the properties of the original element to become distorted

Seeking help with a curious issue I'm encountering. After selecting a radio button and cloning it, the original radio button becomes unchecked while the cloned one behaves as expected. Any insights into why this might be happening would be greatly app ...

javascript cannot utilize html reset functionality

My drop down menu includes an onChange event that triggers a JavaScript method. However, when I select a new value and then click the reset button, the dropdown reverts back to its original value but the onChange event does not fire. <select onChange= ...

Encountering an issue with React where the useContext hook is returning undefined instead of

I am facing an issue where I am attempting to access state and setState from the Store file, but it returns as undefined. Can someone help me understand what is causing this problem and how I can resolve it? import React, {createContext, useState} from &ap ...

Merging a VUE project and a .NET framework project to unleash their full potential

Currently, I am working on a project that involves using VUE for the client side and .net framework for the server side. However, these two components are hosted as separate projects, requiring me to open different ports during development. I am aware tha ...

Activate the Keypress event to update the input value in React upon pressing the Enter

I am facing an issue where I need to reset the value of an input using a method triggered by onPressEnter. Here is the input code: <Input type="text" placeholder="new account" onPressEnter={(event) => this.onCreateAccount(event)}> < ...

Utilizing Vuetify color variables in combination with ternary operators: A guide

I'm experimenting with conditional logic to dynamically change the background color of a button. I've seen examples using the ternary operator to do so, but haven't come across any that utilize color variables defined in the theme options. I ...

Vue Router is not updating the router view when the router link clicked is embedded within the view

I have a section called Related Content located at the bottom of my posts page, which displays other related posts. When I click on the Related Content, I expect the router to update the page. However, it seems that although the URL changes, the view does ...

How to access the state of an @ngrx/data entity in a reducer function in ngrx 8

I am trying to access the state of a ngrx/data entity within a reducer function. Currently, I am working on implementing a pager (pagination) feature where users can navigate through different pages. However, I am facing a challenge in determining the tot ...

Custom properties of an object are being erased when converting to JSON format within the canvas

I am working on a canvas project that involves multiple image objects, each with custom attributes. My goal is to save this canvas as a json object in a database, but the conversion process seems to strip away the custom attributes. Currently, I am using t ...

Error: React-Redux unable to locate Redux context value while utilizing useSelector function

After creating a store and authreducer, everything was working as expected. However, when I added the useSelector in app.js, an error occurred: ERROR Error: could not find react-redux context value; please ensure the component is wrapped in a <Provid ...

Enable or disable dropdown based on selected radio button status

I need the dropdown to be disabled unless the radio button labeled prov is selected. It should only be enabled when prov is chosen. I attempted to create a demo, but it's not functioning correctly and I can't figure out why. HTML: <td colsp ...

``Is there a specific scenario where the use of getInitialProps is recommended when automatically redirecting from one

Within my application, I have set up an auto-redirect from the root directory '/' to '/PageOne' with the following code: const Home = () => { const router = useRouter(); useEffect(() => { router.push('/pageone', ...

Tips for sidestepping CORS issues when using sendFile in Express.js

After successfully deploying my application on Heroku and setting up file serving using Express Js, I encountered a CORS issue when sending requests from the frontend (Angular). This problem only occurs with the route for sending files. Below is the Expre ...