Vue not applying style classHow to change an element's class with JavaScript?How can I select an element with multiple classes in jQuery?What is the difference between call and apply?What is the best way to conditionally apply a class?Is it possible to apply CSS to half of a character?Webpack not extracting CSS into files from vendor vue componentsHow to fix HTML file comments not being ignored by Webpack Dev Server?How include bootstrap and jquery to vue webpack-simple template?Error importing css in vue js single file componentHow to extract style from external vue library imported in project?

How much can I judge a company based on a phone screening?

Bringing Power Supplies on Plane?

How come the Rambam forbids picking up money found in the street?

Boss wants me to ignore a software API license

Chunk + Enumerate a list of digits

Good textbook for queueing theory and performance modeling

How to not forget things?

Scam? Phone call from "Department of Social Security" asking me to call back

Is there a way to proportionalize fixed costs in a MILP?

How do I ask for 2-3 days per week remote work in a job interview?

Why aren’t there water shutoff valves for each room?

What would it take to get a message to another star?

Will using a resistor in series with a LED to control its voltage increase the total energy expenditure?

How would you translate this? バタコチーズライス

What are the odds of rolling specific ability score totals in D&D?

When did Bilbo and Frodo learn that Gandalf was a Maia?

Are employers legally allowed to pay employees in goods and services equal to or greater than the minimum wage?

Should I leave building the database for the end?

Why does the cable resistance jump from a low value to high value at a particular frequency?

Does Stone Golem skin count as “a point on a stone surface” for the Passwall spell?

How was the murder committed?

Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?

What is the most difficult concept to grasp in Calculus 1?

What can Amex do if I cancel their card after using the sign up bonus miles?



Vue not applying style class


How to change an element's class with JavaScript?How can I select an element with multiple classes in jQuery?What is the difference between call and apply?What is the best way to conditionally apply a class?Is it possible to apply CSS to half of a character?Webpack not extracting CSS into files from vendor vue componentsHow to fix HTML file comments not being ignored by Webpack Dev Server?How include bootstrap and jquery to vue webpack-simple template?Error importing css in vue js single file componentHow to extract style from external vue library imported in project?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have single-file components that are built with the following Webpack configuration:



const VueLoaderPlugin = require('vue-loader');

module.exports = {
module:
rules: [

test: /.vue$/,
use: 'vue-loader'
,
jpg,

test: /.css$/,
use: [
'vue-style-loader',

loader: 'css-loader',
options:
modules: true,
localIdentName: '[local]_[hash:base64:8]'


]

]
,
plugins: [
new VueLoaderPlugin()
]


I use the <style scoped> tag to style my components. This works with tag selectors (e.g. nav), but class selectors (e.g. .content) result in no styling. The DOM contains the relevant classes, but the generated dist/main.js file only contains a content_xgKyi9qt[data-v-ab83c772] selector, which is not applied, as the component only has the raw content class.










share|improve this question
























  • share gitrepo link to your code

    – divine
    Mar 27 at 11:33











  • Share image of console where we can see HTML element and styles together.

    – Varit J Patel
    Mar 27 at 12:16

















0















I have single-file components that are built with the following Webpack configuration:



const VueLoaderPlugin = require('vue-loader');

module.exports = {
module:
rules: [

test: /.vue$/,
use: 'vue-loader'
,
jpg,

test: /.css$/,
use: [
'vue-style-loader',

loader: 'css-loader',
options:
modules: true,
localIdentName: '[local]_[hash:base64:8]'


]

]
,
plugins: [
new VueLoaderPlugin()
]


I use the <style scoped> tag to style my components. This works with tag selectors (e.g. nav), but class selectors (e.g. .content) result in no styling. The DOM contains the relevant classes, but the generated dist/main.js file only contains a content_xgKyi9qt[data-v-ab83c772] selector, which is not applied, as the component only has the raw content class.










share|improve this question
























  • share gitrepo link to your code

    – divine
    Mar 27 at 11:33











  • Share image of console where we can see HTML element and styles together.

    – Varit J Patel
    Mar 27 at 12:16













0












0








0








I have single-file components that are built with the following Webpack configuration:



const VueLoaderPlugin = require('vue-loader');

module.exports = {
module:
rules: [

test: /.vue$/,
use: 'vue-loader'
,
jpg,

test: /.css$/,
use: [
'vue-style-loader',

loader: 'css-loader',
options:
modules: true,
localIdentName: '[local]_[hash:base64:8]'


]

]
,
plugins: [
new VueLoaderPlugin()
]


I use the <style scoped> tag to style my components. This works with tag selectors (e.g. nav), but class selectors (e.g. .content) result in no styling. The DOM contains the relevant classes, but the generated dist/main.js file only contains a content_xgKyi9qt[data-v-ab83c772] selector, which is not applied, as the component only has the raw content class.










share|improve this question














I have single-file components that are built with the following Webpack configuration:



const VueLoaderPlugin = require('vue-loader');

module.exports = {
module:
rules: [

test: /.vue$/,
use: 'vue-loader'
,
jpg,

test: /.css$/,
use: [
'vue-style-loader',

loader: 'css-loader',
options:
modules: true,
localIdentName: '[local]_[hash:base64:8]'


]

]
,
plugins: [
new VueLoaderPlugin()
]


I use the <style scoped> tag to style my components. This works with tag selectors (e.g. nav), but class selectors (e.g. .content) result in no styling. The DOM contains the relevant classes, but the generated dist/main.js file only contains a content_xgKyi9qt[data-v-ab83c772] selector, which is not applied, as the component only has the raw content class.







javascript css vue.js webpack






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 11:21









Philipp PloderPhilipp Ploder

6287 silver badges18 bronze badges




6287 silver badges18 bronze badges















  • share gitrepo link to your code

    – divine
    Mar 27 at 11:33











  • Share image of console where we can see HTML element and styles together.

    – Varit J Patel
    Mar 27 at 12:16

















  • share gitrepo link to your code

    – divine
    Mar 27 at 11:33











  • Share image of console where we can see HTML element and styles together.

    – Varit J Patel
    Mar 27 at 12:16
















share gitrepo link to your code

– divine
Mar 27 at 11:33





share gitrepo link to your code

– divine
Mar 27 at 11:33













Share image of console where we can see HTML element and styles together.

– Varit J Patel
Mar 27 at 12:16





Share image of console where we can see HTML element and styles together.

– Varit J Patel
Mar 27 at 12:16












1 Answer
1






active

oldest

votes


















0














Turns out the vue-style-loader options that I used are causing the name mangling. I have decided to switch from <style scoped> to <style module> and use the <div :class="$style.content"> syntax instead.



This causes the class of the element to correspond to the mangled name and provides a level of isolation for styling.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55375986%2fvue-not-applying-style-class%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Turns out the vue-style-loader options that I used are causing the name mangling. I have decided to switch from <style scoped> to <style module> and use the <div :class="$style.content"> syntax instead.



    This causes the class of the element to correspond to the mangled name and provides a level of isolation for styling.






    share|improve this answer





























      0














      Turns out the vue-style-loader options that I used are causing the name mangling. I have decided to switch from <style scoped> to <style module> and use the <div :class="$style.content"> syntax instead.



      This causes the class of the element to correspond to the mangled name and provides a level of isolation for styling.






      share|improve this answer



























        0












        0








        0







        Turns out the vue-style-loader options that I used are causing the name mangling. I have decided to switch from <style scoped> to <style module> and use the <div :class="$style.content"> syntax instead.



        This causes the class of the element to correspond to the mangled name and provides a level of isolation for styling.






        share|improve this answer













        Turns out the vue-style-loader options that I used are causing the name mangling. I have decided to switch from <style scoped> to <style module> and use the <div :class="$style.content"> syntax instead.



        This causes the class of the element to correspond to the mangled name and provides a level of isolation for styling.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 27 at 21:34









        Philipp PloderPhilipp Ploder

        6287 silver badges18 bronze badges




        6287 silver badges18 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55375986%2fvue-not-applying-style-class%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현