Why does CSS render differentlyt between `npm run dev` vs `npm run build`?What does the “+” (plus sign) CSS selector mean?Why do browsers match CSS selectors from right to left?What is the difference between Normalize.css and Reset CSS?Why does HTML think “chucknorris” is a color?What does !important mean in CSS?What does the “~” (tilde/squiggle/twiddle) CSS selector mean?Why does CSS work with fake elements?Vue Webpack Build Breaks Bulma CSSVuetify CSS change order during webpack build
Why does F + F' = 1?
Job offer without any details but asking me to withdraw other applications - is it normal?
How can I locate a missing person abroad?
What is this unknown executable on my boot volume? Is it Malicious?
Why is Kirchoff's Second Law True?
Why is the T-1000 humanoid?
Kerning feedback on logo
Should I leave the first authorship of our paper to the student who did the project whereas I solved it?
When was the earliest opportunity the Voyager crew had to return to the Alpha quadrant?
Pluses and stars inside square visual quiz
What officially disallows US presidents from driving?
Writing a love interest for my hero
Do they still use tiger roars in the 2019 "Lion King" movie?
Which ping implementation is Cygwin using?
How to work with a technician hired with a grant who argues everything
Can a corpse possessed by a Dybbuk be turned via Turn Undead?
Evidence that matrix multiplication cannot be done in O(n^2 poly(log(n))) time
How to help my 2.5-year-old daughter take her medicine when she refuses to?
What jurisdiction do Scottish courts have over the Westminster parliament?
What was the relationship between Einstein and Minkowski?
Is there a star over my head?
Where to disclose a zero day vulnerability
Why would "an mule" be used instead of "a mule"?
Telling my mother that I have anorexia without panicking her
Why does CSS render differentlyt between `npm run dev` vs `npm run build`?
What does the “+” (plus sign) CSS selector mean?Why do browsers match CSS selectors from right to left?What is the difference between Normalize.css and Reset CSS?Why does HTML think “chucknorris” is a color?What does !important mean in CSS?What does the “~” (tilde/squiggle/twiddle) CSS selector mean?Why does CSS work with fake elements?Vue Webpack Build Breaks Bulma CSSVuetify CSS change order during webpack build
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a simple(ish) VueJs (2.5.2) app with a dependency on vuetify (1.5.6). Project was created using Vue cli via IntelliJ, so it's a standard structure.
There is only 1 component in the app, with scoped css like this:
<style scoped>
.app-stores
font-size: 12px;
text-align: center;
.app-stores img
max-width: 190px;
.padded-checkout-btn
padding: 10px;
</style>
And then I use it in the component like so:
<v-btn class="padded-checkout-btn" color="green lighten-1" :disabled="!isCheckoutable()" @click="progressStepper(2)">Checkout currencySymbol + toPrice(calculateTotal())</v-btn>
Now if I run npm run dev
and view it locally in a browser, it looks as I expect with the padding:
However if I run npm run build
(no changes at all to code) and upload to a site, the padding seems to disappear:
I checked the built css file and it does seem to be there:
.padded-checkout-btn[data-v-dedb1744]padding:10px
And if I inspect the resulting source I can see it declared there:
<button data-v-dedb1744="" type="button" class="padded-checkout-btn v-btn theme--light green lighten-1"><div class="v-btn__content">Checkout £7.00</div></button>
Question: Why are they different? Even if somehow the CSS is hidden, the whole point of running dev vs build is that they're the same? Any ideas as to how to diagnose/fix?
dev
and build
are defined like this:
"scripts":
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"unit": "jest --config test/unit/jest.conf.js --coverage",
"test": "npm run unit",
"lint": "eslint --ext .js,.vue src test/unit",
"build": "node build/build.js"
css vuejs2 vuetify.js
|
show 1 more comment
I have a simple(ish) VueJs (2.5.2) app with a dependency on vuetify (1.5.6). Project was created using Vue cli via IntelliJ, so it's a standard structure.
There is only 1 component in the app, with scoped css like this:
<style scoped>
.app-stores
font-size: 12px;
text-align: center;
.app-stores img
max-width: 190px;
.padded-checkout-btn
padding: 10px;
</style>
And then I use it in the component like so:
<v-btn class="padded-checkout-btn" color="green lighten-1" :disabled="!isCheckoutable()" @click="progressStepper(2)">Checkout currencySymbol + toPrice(calculateTotal())</v-btn>
Now if I run npm run dev
and view it locally in a browser, it looks as I expect with the padding:
However if I run npm run build
(no changes at all to code) and upload to a site, the padding seems to disappear:
I checked the built css file and it does seem to be there:
.padded-checkout-btn[data-v-dedb1744]padding:10px
And if I inspect the resulting source I can see it declared there:
<button data-v-dedb1744="" type="button" class="padded-checkout-btn v-btn theme--light green lighten-1"><div class="v-btn__content">Checkout £7.00</div></button>
Question: Why are they different? Even if somehow the CSS is hidden, the whole point of running dev vs build is that they're the same? Any ideas as to how to diagnose/fix?
dev
and build
are defined like this:
"scripts":
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"unit": "jest --config test/unit/jest.conf.js --coverage",
"test": "npm run unit",
"lint": "eslint --ext .js,.vue src test/unit",
"build": "node build/build.js"
css vuejs2 vuetify.js
1
could you show us the associated commands ofrun
andbuild
frompackage.json
?
– samb102
Mar 28 at 9:25
I think the css you are having for development is not working or not present when you create the build of your project. I think it is the css not loading up.
– AKASH PANDEY
Mar 28 at 10:22
@samb102 copy/pasted the script line frompackage.json
into the post
– Manish Patel
Mar 28 at 13:17
@AKASHPANDEY i can see it in the built css file. Also the other 2 css declarations seem to work ok
– Manish Patel
Mar 28 at 13:19
But does the button have the attribute that’s in the css?
– Strelok
Mar 28 at 13:29
|
show 1 more comment
I have a simple(ish) VueJs (2.5.2) app with a dependency on vuetify (1.5.6). Project was created using Vue cli via IntelliJ, so it's a standard structure.
There is only 1 component in the app, with scoped css like this:
<style scoped>
.app-stores
font-size: 12px;
text-align: center;
.app-stores img
max-width: 190px;
.padded-checkout-btn
padding: 10px;
</style>
And then I use it in the component like so:
<v-btn class="padded-checkout-btn" color="green lighten-1" :disabled="!isCheckoutable()" @click="progressStepper(2)">Checkout currencySymbol + toPrice(calculateTotal())</v-btn>
Now if I run npm run dev
and view it locally in a browser, it looks as I expect with the padding:
However if I run npm run build
(no changes at all to code) and upload to a site, the padding seems to disappear:
I checked the built css file and it does seem to be there:
.padded-checkout-btn[data-v-dedb1744]padding:10px
And if I inspect the resulting source I can see it declared there:
<button data-v-dedb1744="" type="button" class="padded-checkout-btn v-btn theme--light green lighten-1"><div class="v-btn__content">Checkout £7.00</div></button>
Question: Why are they different? Even if somehow the CSS is hidden, the whole point of running dev vs build is that they're the same? Any ideas as to how to diagnose/fix?
dev
and build
are defined like this:
"scripts":
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"unit": "jest --config test/unit/jest.conf.js --coverage",
"test": "npm run unit",
"lint": "eslint --ext .js,.vue src test/unit",
"build": "node build/build.js"
css vuejs2 vuetify.js
I have a simple(ish) VueJs (2.5.2) app with a dependency on vuetify (1.5.6). Project was created using Vue cli via IntelliJ, so it's a standard structure.
There is only 1 component in the app, with scoped css like this:
<style scoped>
.app-stores
font-size: 12px;
text-align: center;
.app-stores img
max-width: 190px;
.padded-checkout-btn
padding: 10px;
</style>
And then I use it in the component like so:
<v-btn class="padded-checkout-btn" color="green lighten-1" :disabled="!isCheckoutable()" @click="progressStepper(2)">Checkout currencySymbol + toPrice(calculateTotal())</v-btn>
Now if I run npm run dev
and view it locally in a browser, it looks as I expect with the padding:
However if I run npm run build
(no changes at all to code) and upload to a site, the padding seems to disappear:
I checked the built css file and it does seem to be there:
.padded-checkout-btn[data-v-dedb1744]padding:10px
And if I inspect the resulting source I can see it declared there:
<button data-v-dedb1744="" type="button" class="padded-checkout-btn v-btn theme--light green lighten-1"><div class="v-btn__content">Checkout £7.00</div></button>
Question: Why are they different? Even if somehow the CSS is hidden, the whole point of running dev vs build is that they're the same? Any ideas as to how to diagnose/fix?
dev
and build
are defined like this:
"scripts":
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"unit": "jest --config test/unit/jest.conf.js --coverage",
"test": "npm run unit",
"lint": "eslint --ext .js,.vue src test/unit",
"build": "node build/build.js"
css vuejs2 vuetify.js
css vuejs2 vuetify.js
edited Mar 28 at 13:35
Manish Patel
asked Mar 28 at 9:23
Manish PatelManish Patel
2,7523 gold badges18 silver badges35 bronze badges
2,7523 gold badges18 silver badges35 bronze badges
1
could you show us the associated commands ofrun
andbuild
frompackage.json
?
– samb102
Mar 28 at 9:25
I think the css you are having for development is not working or not present when you create the build of your project. I think it is the css not loading up.
– AKASH PANDEY
Mar 28 at 10:22
@samb102 copy/pasted the script line frompackage.json
into the post
– Manish Patel
Mar 28 at 13:17
@AKASHPANDEY i can see it in the built css file. Also the other 2 css declarations seem to work ok
– Manish Patel
Mar 28 at 13:19
But does the button have the attribute that’s in the css?
– Strelok
Mar 28 at 13:29
|
show 1 more comment
1
could you show us the associated commands ofrun
andbuild
frompackage.json
?
– samb102
Mar 28 at 9:25
I think the css you are having for development is not working or not present when you create the build of your project. I think it is the css not loading up.
– AKASH PANDEY
Mar 28 at 10:22
@samb102 copy/pasted the script line frompackage.json
into the post
– Manish Patel
Mar 28 at 13:17
@AKASHPANDEY i can see it in the built css file. Also the other 2 css declarations seem to work ok
– Manish Patel
Mar 28 at 13:19
But does the button have the attribute that’s in the css?
– Strelok
Mar 28 at 13:29
1
1
could you show us the associated commands of
run
and build
from package.json
?– samb102
Mar 28 at 9:25
could you show us the associated commands of
run
and build
from package.json
?– samb102
Mar 28 at 9:25
I think the css you are having for development is not working or not present when you create the build of your project. I think it is the css not loading up.
– AKASH PANDEY
Mar 28 at 10:22
I think the css you are having for development is not working or not present when you create the build of your project. I think it is the css not loading up.
– AKASH PANDEY
Mar 28 at 10:22
@samb102 copy/pasted the script line from
package.json
into the post– Manish Patel
Mar 28 at 13:17
@samb102 copy/pasted the script line from
package.json
into the post– Manish Patel
Mar 28 at 13:17
@AKASHPANDEY i can see it in the built css file. Also the other 2 css declarations seem to work ok
– Manish Patel
Mar 28 at 13:19
@AKASHPANDEY i can see it in the built css file. Also the other 2 css declarations seem to work ok
– Manish Patel
Mar 28 at 13:19
But does the button have the attribute that’s in the css?
– Strelok
Mar 28 at 13:29
But does the button have the attribute that’s in the css?
– Strelok
Mar 28 at 13:29
|
show 1 more comment
1 Answer
1
active
oldest
votes
Fixed. Thanks to @Strelok for nudging me in the right direction. It's do with the ordering in which the css is applied. Change the declaration to:
.padded-checkout-btn
padding: 10px !important;
ensured it was applied after everything else (I guess...)
Still don't really understand why it works on Dev build and not prod build though.
its because all your css is minified when you build the production build and the position of the class overriding your class would have been below it hence overriding your css but anyways using !important should be the last resort for anything
– AKASH PANDEY
Mar 29 at 11:31
@AKASHPANDEY the prod build should behave the same way; There must be a way to ensure this. Otherwise the development process is a bit flaky.
– Manish Patel
Apr 1 at 12:52
add a comment |
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/4.0/"u003ecc by-sa 4.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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55394047%2fwhy-does-css-render-differentlyt-between-npm-run-dev-vs-npm-run-build%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
Fixed. Thanks to @Strelok for nudging me in the right direction. It's do with the ordering in which the css is applied. Change the declaration to:
.padded-checkout-btn
padding: 10px !important;
ensured it was applied after everything else (I guess...)
Still don't really understand why it works on Dev build and not prod build though.
its because all your css is minified when you build the production build and the position of the class overriding your class would have been below it hence overriding your css but anyways using !important should be the last resort for anything
– AKASH PANDEY
Mar 29 at 11:31
@AKASHPANDEY the prod build should behave the same way; There must be a way to ensure this. Otherwise the development process is a bit flaky.
– Manish Patel
Apr 1 at 12:52
add a comment |
Fixed. Thanks to @Strelok for nudging me in the right direction. It's do with the ordering in which the css is applied. Change the declaration to:
.padded-checkout-btn
padding: 10px !important;
ensured it was applied after everything else (I guess...)
Still don't really understand why it works on Dev build and not prod build though.
its because all your css is minified when you build the production build and the position of the class overriding your class would have been below it hence overriding your css but anyways using !important should be the last resort for anything
– AKASH PANDEY
Mar 29 at 11:31
@AKASHPANDEY the prod build should behave the same way; There must be a way to ensure this. Otherwise the development process is a bit flaky.
– Manish Patel
Apr 1 at 12:52
add a comment |
Fixed. Thanks to @Strelok for nudging me in the right direction. It's do with the ordering in which the css is applied. Change the declaration to:
.padded-checkout-btn
padding: 10px !important;
ensured it was applied after everything else (I guess...)
Still don't really understand why it works on Dev build and not prod build though.
Fixed. Thanks to @Strelok for nudging me in the right direction. It's do with the ordering in which the css is applied. Change the declaration to:
.padded-checkout-btn
padding: 10px !important;
ensured it was applied after everything else (I guess...)
Still don't really understand why it works on Dev build and not prod build though.
edited Mar 28 at 16:02
answered Mar 28 at 13:46
Manish PatelManish Patel
2,7523 gold badges18 silver badges35 bronze badges
2,7523 gold badges18 silver badges35 bronze badges
its because all your css is minified when you build the production build and the position of the class overriding your class would have been below it hence overriding your css but anyways using !important should be the last resort for anything
– AKASH PANDEY
Mar 29 at 11:31
@AKASHPANDEY the prod build should behave the same way; There must be a way to ensure this. Otherwise the development process is a bit flaky.
– Manish Patel
Apr 1 at 12:52
add a comment |
its because all your css is minified when you build the production build and the position of the class overriding your class would have been below it hence overriding your css but anyways using !important should be the last resort for anything
– AKASH PANDEY
Mar 29 at 11:31
@AKASHPANDEY the prod build should behave the same way; There must be a way to ensure this. Otherwise the development process is a bit flaky.
– Manish Patel
Apr 1 at 12:52
its because all your css is minified when you build the production build and the position of the class overriding your class would have been below it hence overriding your css but anyways using !important should be the last resort for anything
– AKASH PANDEY
Mar 29 at 11:31
its because all your css is minified when you build the production build and the position of the class overriding your class would have been below it hence overriding your css but anyways using !important should be the last resort for anything
– AKASH PANDEY
Mar 29 at 11:31
@AKASHPANDEY the prod build should behave the same way; There must be a way to ensure this. Otherwise the development process is a bit flaky.
– Manish Patel
Apr 1 at 12:52
@AKASHPANDEY the prod build should behave the same way; There must be a way to ensure this. Otherwise the development process is a bit flaky.
– Manish Patel
Apr 1 at 12:52
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55394047%2fwhy-does-css-render-differentlyt-between-npm-run-dev-vs-npm-run-build%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
could you show us the associated commands of
run
andbuild
frompackage.json
?– samb102
Mar 28 at 9:25
I think the css you are having for development is not working or not present when you create the build of your project. I think it is the css not loading up.
– AKASH PANDEY
Mar 28 at 10:22
@samb102 copy/pasted the script line from
package.json
into the post– Manish Patel
Mar 28 at 13:17
@AKASHPANDEY i can see it in the built css file. Also the other 2 css declarations seem to work ok
– Manish Patel
Mar 28 at 13:19
But does the button have the attribute that’s in the css?
– Strelok
Mar 28 at 13:29