I'm trying to change the color theme of bootstrap with sass. I'm running the command npm run watch and when I save it does in prompt me with:
Laravel Mix Build Successful
When I view my page I do not see the changes. (I've cleared cache and hard refreshed as well as closed broswer/new browser) To do this I'm updating "warning" to be a purplish color, but bg-warning is not changing to a purplish background (I believe this is what is intended).
I'm using Laravel framework 5.5
Here is my webpack.mix.js
Here is my app.scss
Here is my base/_colors.scss
I've tried throwing my base/_colors.scss code straight into the app.scss file with no luck either. (Even though it says it builds properly.)
I've also tried running the following with no success:
npm run dev
npm run production
Edit: the other possibility is this is not how sass works with bootstrap. Do I need to actually assign things the color of $warning or does this look for all instances of $warning (.alert-warning, .bg-warning, etc.) and replace?
Try running npm hot, that helped me:
npm run hot
I would do following further steps:
check if the folder base really exists
create a a new css file which in not inside a folder (base) just to check that that does not cause an error
Write simple css in your _colors.css and check if that works
add an !important statement after your color declaration to check if it does not have to do anything relating overriding the styling
Related
I've tried to write SCSS in my Maven project with React in IDEA. I have sass and sass-loader in npm packages. But I always get a weird error:
Syntax error: missing semicolon
This is a very simple scss example for test. I can't use other tag selectors as well. I've added scss variable on the top to see if it causes an error but it doesn't and all the errors stop at tags. I think that means that scss file is readable after all. And everything is ok when using just css. What's going on?
I solved the problem. Maybe someday it would be useful for somebody.
The point is I missed restarting webpack when changing it. I found configs for sass-loader on its npm page and added it to my webpack.config.js and then run webpack --watch --progress. Everything finally worked
I'm using angular 11 with scss. I'm serving the app using ng serve --aot command. It watches the files and compile the app after every change. When there are errors, the CLI detect the it and display the error. After I fix it, it recompiles the files and serves the app.
However, sometimes when there are scss errors, the CLI doesn't detect the changes I make in order to fix the error, and I have to cancel the serve command and rerun it.
For example:
I had an error because I forgot to import a scss file that contained the definition of a variable I used. The CLI showed me the error:
I fixed the error and saved the file, but the CLI didn't recompile the files. I had to press ctrl+c to cancel the ng-serve command and rerun it, and it worked.
It also happens when I make small changes in SCSS files, like adding "background color" and before I write the color itself, VS code adds ; to the line, creating an error ( because the line is : background-color: ;). After fixing it, the CLI doesn't detect the changes.
Any idea why it doesn't detect the changes I make? It happens only in scss errors. when I have TS errors, it detects the fixes perfectly.
I'm a complete beginner with SASS!
I have a custom built WP site which uses SASS.
When I try to edit any styles inside the .SCSS files these changes do not show on the frontend.
I'm using VS Code editor with the "Live SASS compiler" add-on but still when I make changes they do not reflect on the front end.
I'm clearly missing something here but really don't know where to start.
All I want to do is make changes to the styling of the site!
Thanks
You will need to ensure that SASS is installed on your machine - check out the offical install link.
Once SASS is installed, the rest of this answer will involve using the command line with some basic commands.
Lets assume your CSS and SCSS/SASS folders are arranged like so:
C:/Users/Me/development
/wordpress/wp-content/themes/my-theme/assets/css
/wordpress/wp-content/themes/my-theme/assets/scss
Open up your preferred command line interface - like PowerShell or Command Prompt. First of all, check SASS is installed by typing the following command and hitting enter:
sass --version
You should get a number back - if not, you will need to run over the installation instructions again and make sure you did everything correctly.
If that's working as expected, you will now need to navigate to the directory containing your assets. When you load your command line interface, you should be inside your user or home directory - in this example that will be C:/Users/Me. If using PowerShell, you will see your current working directory before the flashing caret.
You can use the change directory command - cd - to navigate to your themes assets folder. Using the above example filepath:
cd development/wordpress/wp-content/themes/my-theme/assets
Once inside this directory, you can run the SASS --watch command to watch the directories for changes and compile upon save:
sass --watch scss:css
The above watches the SCSS folder and puts the compiled CSS in the CSS folder. Once you're done editing, hit CTRL/CMD + C inside your terminal (command line) and then Y to stop watching the SCSS files for changes.
I am using Vue in laravel. When I make changes in vue code these changes doesn't appear until I run this command:
npm run production
I want to use vue without this command or at least one time should be enough
The Vue code that you write must be transpiled to vanilla javascript so that most of the browsers out there can understand it (not all browsers understand Vue or the underlying javascript version, such as ES6).
Additionally, most likely the code you write has many dependencies (including Vue itself) but also many other libraries. npm run generates a single javascript file with all the necessary code to run, but also stripping out all other portions of libraries that you don't use. If this didn't happen, it would take a lot of time to your page to load because the browser would need to load all the libraries.
You can simply run npm run watch to keep building vue into vanilla javascript code as you are working on vue components.
What does npm run watch does exactly?
In package.json file in the root folder of your laravel project, you can see that there is a script of "watch" which then runs npm run development -- --watch. Here, --watch part is important. npm run development compiles or builds vue components into ./public/js/app.js and also creates css styles in ./public/css/ corresponding to the styles that you apply inside vue components tags.
./public/js/app.js and ./public/css/*.css files are then included in php blades and it serves as vue components.
Using npm run development is recommeded while you are working on your local dev environment rather than npm run production, which command itself implies that it builds production version of vue components. In production version, vue-devtools cannot inspect vue components but it does in development version.
And as --watch part keeps its eye on vue components' chages and it builds as soon as you make any change in .vue files. So you run npm run watch once, you are good to go. No need to run npm run development or npm run production every time.
To update our code on port id need to run npm rum production command
I use sass code in nuxt components simply by adding lang="scss" in the style tags. When I add this attribute to the style tag in a layout file (layouts folder) the style tag isn't processed any more and the following css (scss) code ignored.
Can anybody explain what's happening and how to fix this issue?
You have to install node-sass and sass-loader in order to use pre-processor, run this terminal command in the project folder
npm install sass-loader node-sass --save-dev
And take a look this link to enable other pre-processor in Vue, Pre-Processors - vue-loader
Problem solved: After having re-started the dev server (npm run dev) nuxt compiled scss code correctly. The issue seems to be limited to the live browser update in dev mode.