How to use stylus block level import with Vuetify styles - less

Using a stylus block level import:
# vuetify-style.styl
.myapp
#import '~vuetify/src/stylus/main'
This is to ensure that the vuetify css doesn't interfere with elements from other parts of the page which aren't using vuetify.
But unfortunately it doesn't work, I can't compile it.
ERROR Failed to compile with 1 errors 2:13:28 pm
error in ./src/stylus/main.styl
Module build failed (from ./node_modules/stylus-loader/index.js):
Error: node_modules/vuetify/src/stylus/settings/_el
evations.styl:85:33
81| 0px 9px 46px 8px $shadow-key-ambient-opacity
82|
83| // MIXINS
84| elevation($z, important = false)
85| box-shadow: $shadow-key-umbra[$z],
---------------------------------------^
86| $shadow-key-penumbra[$z],
87| $shadow-key-ambient[$z] (important ? !important : )
88|
cannot perform $shadow-key-umbra[((0))]
It compiles only when I delete the first line (.myapp)
Link to the issue on github: https://github.com/vuetifyjs/vuetify/issues/4864
BTW I also tried to use less and import css from the package
# vuetify-style.less
vuetify-styles {
#import (less) 'vuetify/dist/vuetify.css';
}
But in this way I also got an error:
ERROR Failed to compile with 1 errors 11:57:30 AM
error in ./src/plugins/vuetify-styles.less
Module build failed:
// load the styles
var content = require("!!../../node_modules/css-loader/index.js??ref--9-1!../../node_modules/p
ostcss-loader/lib/index.js??ref--9-2!../../node_modules/less-loader/dist/cjs.js??ref--9-3!./vu
etify-styles.less");
^
Unrecognised input
in /Users/zvadym/WorkProjects/motos_as/odin/vue/src/plugins/vuetify-styles.less (line 4,
column 12)
# ./src/plugins/vuetify-styles.less 4:14-334 13:3-17:5 14:22-342
# ./src/plugins/vuetify.js
# ./src/crm/main.js
# multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/crm/ma
in.js

Found a way to deal with it. Actually I just specified the full relative path to the style file
.vuetify-styles {
#import (less) '../../node_modules/vuetify/dist/vuetify.css';
}
and installed less of course npm install -D less less-loader

Related

Error after added Nuxt to my vue project (vue-style-loader css error)

Help me please. Added Nuxt(SSR) to the my vue project. All moved to the root of the project, created a page folder. The following error appeared:
ERROR in ./.nuxt/components/nuxt-loading.vue?vue&type=style&index=0&lang=css& (./node_modules/css-loader/dist/cjs.js??ref--3-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--3-oneOf-1-2!./node_modules/vue-loader/lib??vue-loader-options!./.nuxt/components/nuxt-loading.vue?vue&type=style&index=0&lang=css&)
Module build failed (from ./node_modules/css-loader/dist/cjs.js):
ValidationError: Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options.modules has an unknown property 'compileType'. These properties are valid:
object { auto?, mode?, exportGlobals?, localIdentName?, localIdentRegExp?, context?, hashPrefix?, getLocalIdent? }
at validate (/app/node_modules/css-loader/node_modules/schema-utils/dist/validate.js:98:11)
at Object.loader (/app/node_modules/css-loader/dist/index.js:36:28)
# ./.nuxt/components/nuxt-loading.vue?vue&type=style&index=0&lang=css& (./node_modules/vue-style-loader??ref--3-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--3-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--3-oneOf-1-2!./node_modules/vue-loader/lib??vue-loader-options!./.nuxt/components/nuxt-loading.vue?vue&type=style&index=0&lang=css&) 4:14-327
# ./.nuxt/components/nuxt-loading.vue?vue&type=style&index=0&lang=css&
# ./.nuxt/components/nuxt-loading.vue
# ./.nuxt/App.js
# ./.nuxt/index.js
# ./.nuxt/client.js
# multi ./.nuxt/client.js
code from nuxt.config.js:
import { resolve } from 'path'
export default {
alias: {
style: resolve(__dirname, './assets/style'),
},
}
As I understand the error is related to the setting of the Nuxt.
In your package.json you do have sass-loader set to ^12.1.0, meanwhile the package introduces a breaking change during v11.0.0.
It requires Webpack5, which Nuxt is not compatible as of today. If you downgrade it down to v10.1.1 (and all related packages like node-sass), you should be fine.

BootstrapVue Unknown word Error in ./node_modules/bootstrap-vue/src/index.scss

i would like to use bootstrap vue with my own scss file for theming.
Unfortunately I always get a strange error:
ERROR Failed to compile with 1 error
error in ./node_modules/bootstrap-vue/src/index.scss
Syntax Error: SyntaxError
(1:1) Unknown word
> 1 | // --- BootstrapVue Custom SCSS ---
| ^
2 |
3 | // Requires at least the Bootstrap functions, variables and
# ./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-oneOf-1-2!./src/assets/custom.scss 4:40-286
# ./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-oneOf-1-2!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=style&index=0&lang=css&
# ./node_modules/vue-style-loader??ref--6-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-oneOf-1-2!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=style&index=0&lang=css&
# ./src/App.vue?vue&type=style&index=0&lang=css&
# ./src/App.vue
# ./src/main.js
# multi (webpack)-dev-server/client?http://192.168.1.20:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
For the structure I followed exactly the docs
My custom.scss File:
$theme-colors: (
"primary": #51ff00,
"danger": #ff4136
);
#import '../../node_modules/bootstrap/scss/bootstrap.scss';
#import '../../node_modules/bootstrap-vue/src/index.scss';
and the main.js File:
// ***** Bootstrap Vue *****
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
import './assets/custom.scss'
Vue.use(BootstrapVue)
Vue.use(IconsPlugin)
I'm using the recommended Versions of
"bootstrap": "^4.5.3",
"bootstrap-vue": "^2.21.2",
"sass": "^1.32.13",
"sass-loader": "^10.2.0"
What could be the problem here?
Solution:
I accidentally imported my custom.scss file into my app.vue additionally
<style>
#import 'assets/custom.scss';
</style>

Vue Enterprise Boilerplate: sass-loader unable to load from updated .scss files

I'm rewriting an existing project using the latest vue enterprise boilerplate. I haven't been able to find any examples of the use of vue enterprise boilerplate so I'm doing trial and error. When using some of the existing code with large <style> blocks I'm running into compile problems importing from .scss files which are all in the directory src/design/. This code
<style lang="scss" module>
#import '#design';
.container {
#extend %relative-block;
...
throws this error
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: The target selector was not found.
Use "#extend %relative-block !optional" to avoid this error.
╷
86 │ #extend %relative-block;
│ ^^^^^^^^^^^^^^^^^^^^^^^
╵
/home/dean/src/vue/examples/rewrite.0/src/components/nav-bar.vue 86:3 root stylesheet
The relative-block exists in the design/_positioning.scss file and Intellij is able to find it
%relative-block {
position: relative;
display: block;
}
I also get errors when using sass #mixins:
#include lq-size(100%, 100%);
gives
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined mixin.
╷
50 │ #include lq-size(100%, 100%);
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
/home/dean/src/vue/examples/rewrite.0/src/app.vue 50:3 root stylesheet
The #mixin lq-size exists and Intellij finds it in design/_mixins.css:
#mixin lq-size($width, $height) {
width: $width;
height: $height;
}
These errors occur for code in new .scss files that I've added to the src/design/ directory, and for new code in existing .scss files.
I'm new to sass and scss. When I update a .scss file of add a new .scss file into the src/design/ folder do I have to tell the sass-loader to look for updated .scss files?

Module build failed for Saas Loader - NuxtJS

I am trying to use scss like below in my nuxt application. But this is not working and throwing module failed error. I have use saas-loader & node-saas as dev dependencies.
Do I need to make changes in my nuxt.config.js file too?
<style lang="scss" scoped>
#use "../assets/styles/functions" as f;
#use "../assets/styles/variables" as v;
#use "../assets/styles/components/containers/page-container";
#use "../assets/styles/components/buttons/primaryBtn";
.l-empty-page__content {
font-family: v.$body-font;
}
Error
Module build failed (from ./node_modules/sass-loader/dist/cjs.js): friendly-errors 23:27:19
SassError: Invalid CSS after " font-family: v": expected expression (e.g. 1px, bold), was ".$body-font;"
on line 15 of C:\Workspaces\nuxt-ssr\pages\test.vue
>> font-family: v.$body-font;

CSS minification error in npm run build [vue.js]

Im receiving this error everytime I try to run 'npm run build' and I dont have any css file.
ERROR Error: CSS minification error: Unexpected ":" found.. File: css/app.86f0ef2e.css
Error: CSS minification error: Unexpected ":" found.. File: css/app.86f0ef2e.css
at C:\Users\LesterKingsley\OneDrive\Desktop\vuewuna\dos\node_modules#intervolga\optimize-cssnano-plugin\index.js:106:21
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Promise.all (index 0)
I'm new to vue, I don't have a clue to solve this problem.
I faced this same error last week, and this is my solution to it. I'm not sure if it's going to work for you though.
What I did basically was these;
I found and removed the file that course the error (in my case public/css/argon.css) then I cut out all the codes inside of that file and saved.
Then I ran npm run build and it built successfully.
After the build process had completed, I then pasted the codes inside of the file (in my case dist/css/argon.css) and the vuejs created css.
That solved the problem.
Pls give a thumbs up if that works for you.
The problem is sometimes in the ::v-deep label:
// WRONG:
::v-deep(.some-class) { ... }
// READY:
::v-deep .some-class { ... }
Please comment all your internal css. This work for me successfully.
I too did not have any external css file. But the issues were in my internal files.
This is the line that cause the error text-align: calc();
I got this error.
For me the problem was this:
input['text'],
input['email'] {
user-select: initial;
}