NextJS - How to disable sass preprocessing for next dev script - sass

In a NextJS project I am just styling right now. Even though I am just changing scss files, next dev script of course compiles everything.
Is there a way to disable the sass preprocessing, so that I can run it from my IDE without triggering the time consuming compiler? E.g. with a change in next.config.js?

Related

Odoo - How To Manage & Update Static Files

Static Files in Odoo
I'm new to Odoo, and am working through developing a custom theme for a client. I've worked through the theme tutorial despite the many errors and omissions that exist in that documentation (going to make a pull request to update that after I'm done). My latest struggle is dealing with static files in Odoo, specifically images in the theme.
The Setup
Running Odoo 13.0.20200323 on Ubuntu 18.04 in VirtualBox managed by Vagrant and provisioned with Ansible
The Problem
Changes to image files in the static folder are not reflected on the website. This includes updating the theme in the website theme settings (the update function seems to update everything else). I've changed image names, image content, moved them into other folder, and have not been able to figure out how to have any changes updated on the website. I've restarted the server, doesn't change anything. Updated the theme as stated above, doesn't work. The only way I've been able to have any changes reflected on the front end is to completely destroy and rebuild the server.
Questions
What am I missing? Is there a function I'm not running to trigger Odoo to update what it serves from the static folder?
How does Odoo work with static files in general? On the fly updates to files in the static folder don't seem to have any changes on the front end. Are the files in the static folder copied somewhere else on install, and then served from that other location?
Understanding
I understand that having images and other files change in a folder called static, doesn't make much sense functionally, and that's not my intention for this. Since I'm in development I need to make changes to files, like SCSS, JS, and images, and have those updates reflected on the front end without having to destroy and rebuild the server every time. To be clear, changes to SCSS and JS files that I've registered in .xml files and bundled with various Odoo bundles update just fine when I make changes to them and then update the theme on the backend in the theme management view.
My desire is to understand how Odoo handles the files in the static folder in general, how to update those files properly, and how to manage them while developing and for release.
Answers
I've figured out an answer to the first part of the question as to what I'm doing wrong. It seems like a browser caching issue. When performing a hard reload, empty cache and hard reload, or visiting the site in an incognito window changes are reflected to imagery.
As far as I can tell Odoo is just serving files from the static folder directly. Please correct me if this is not the case.
Follow-up
Does anyone have a good solution for working with changes like this and dealing with browser caching issues?
Answer: I've set up a a couple gulp tasks that use gulp-rev (will replace with gulp-rev-all soon) rev-del and rev-rewrite to handle cache busting through appending hashes to the file names.
I'm going to try setting up Browser-sync in proxy mode to see how that deals with changes to files on reload. I'll report what I find!
Update: Browser-sync has worked well so far as expected. But was kind of useless until I figured out how to work out a fix for the problem below
Does anyone know of how to automate Odoo rebuilding SCSS, JS etc. bundles? So that on file change the theme can be updated and the results seen without having to manually update the theme on the backend to see the results?
Answer: The main task was figuring out how to get live HTML/XML updates working. Which meant building Odoo from the source, and not making any updates or changes to the theme on the backend or frontend from within the Odoo interface. Passing the option --dev xml to Odoo when starting it with odoo-bin allows for the XML code to be evaluated directly, and makes live updates possible. But this extremely helpful (almost necessary) functionality is broken when you make any updates to the them from within Odoo. I'll report on any work arounds to this, but for now as long as I don't touch the theme from within Odoo (update the theme or make edits to it with their editor) then it works great. Also I had to bypass bundling my CSS and JS with their bundler initially to get those updates working live, but may be able to go back and rebundle them now that the code is being evaluated directly.
⭐️Boilerplate and Tutorial Series ⭐️
I'm going to get my whole process for theme building dialed in and then I'll be sharing the boilerplate and build tools on GitHub and also writing and filming a tutorial series on it. Since the built in documentation on that front is straight up error filled, omits critical information and also

Jekyll not refreshing changes to custom CSS Subdirectory

For work I have to manage styles and keep them consistent between two different sites. To accomplish this, I created a repository where I can use gulp/scss to export the CSS I need. Changing this is not an available option for me.
One of the sites is built using Jekyll. I have cloned the CSS directory and pointed the CSS to pull from that directory, no problem. When I make changes to the scss, the gulp task exports the CSS, but the changes are reflected when I am running the site. It detects the changes and says it regenerates the file, but the CSS simply doesn't get updated. If I stop the Jekyll process and re-run bundle exec jekyll serve - the css changes immediately show up.
Basically, I just want to know if there is a way to make sure these files get updated. Any help would be greatly appreciated.

DocPad slow on livereload and docpad server reloading every time

I'm fighting for some time with docpad performance in local development. Have issue with live reload. Small change in some less file takes even 100sec to regenerate and reload the server. It looks like even though there was a change in one file, he regenerates everything. I've added those, as suggested on docpad page:
watchOptions:
preferredMethods: ['watchFile','watch']
catchupDelay: 0
regenerateDelay: 0
also disabled tag plugin for local dev, as he is pretty nasty with its constant tags regeneration.
I'm on docpad 6.63.8 with the following plugins: coffeescript, eco, gulp, highlightjs, less, livereload, lunr, marked, paged, partials, tags, text
I thought that I will simply get over it with gulp watch, but obviously watch is not enough, server needs to be reloaded anyway and I don't think it is possible to replace livereload plugin with gulp livereload or I'm just to stupid to do this
I'm using text plugin a lot, and maybe it slows down?
I wanted to overcome the issue by using gulp for watching and regeneration and manual restart of the server and docpad server but I noticed that docpad server is regenerating all the files, even though they were already regenerated and are in the out dir.
Any ideas?
Yep - I've seen this problem with livereload. I see it especially with dynamic pages. To be honest I think the best solution for the moment is to just remove livereload - remove it from the package.json file and delete the livereload node_modules directory. To my mind, livereload is only saving you from having to hit the reload button on the browser.

Force JBoss to reload JavaScript files

I am using JBoss Application Server 4.2.
I have noticed that when I update an .xhtml file, my local server will immediately reflect the change. However, if I update a .js file, it will not update until I restart the server. This is a huge hassle when I am working with .js files; any time I want to test a change, I need to restart the server.
Is there a way I can force JBoss to stop caching the file? Please note, solutions like this one don't work; the framework automatically includes the .js file, and I cannot change the <script src="..."> text manually.
This isn't a very elegant "solution," but I have three workarounds I've been using which mitigate the problem. I'll post them below for anyone else who has the same problem as I did:
Edit the .xhtml file on the server to add a dummy GET variable to the filename in the <script src="..."> tag. See here. In my case, because I'm using an external framework, this meant editing a XML file, which the server apparently doesn't cache.
Advantages: this will reload properly every time.
Disadvantages: I have to make sure I don't deploy the code to production with the dummy GET variable. Also, I lose any breakpoints in my debugger, which doesn't recognize that it's the same JS file.
Edit the file on the server, then make the exact same changes dynamically in Chrome debugger. See here.
Advantages: no need to worry about breakpoints or deploying bad code. No need even reload the page.
Disadvantages: the changes disappear as soon as I hit the reload button. Also, it's easy to make a mistake when synching the code.
Put the JavaScript code in the .xhtml file under its own <script> tag, then migrate it over to the .js file when ready to commit the changes.
Advantages: page reloads properly each time.
Disadvantages: migrating the code to the .js is a hassle, and it's easy to accidentally introduce bugs.
Neither of these solutions is perfect, but they work as decent patches. Of course, if anyone has a real solution to actually make the server stop caching the file, I'd still love to hear it.

Sass development workflow issues

I've been trying to adopt Sass into my development workflow. I do primarily front-end development and as such, I am updating stylesheets quite frequently. After endless searching, I have yet to find the answer to what I feel should be a simple question.
I use both Coda and Textmate, so a solution for either would suffice. When developing locally, I open the terminal, get my .scss file watched, then go to town. I save my .scss file, it happily updates my .css file... and then I'm left with the slight annoyance of having to manually select the .css and publish it to the remote server. Its not the end of the world but having to pause my usual dev workflow to manually upload a file I'm not actively in is becoming a nuisance. In Coda, it doesn't detect when a file has been updated outside of Coda, so it isn't marked for publishing. Its driving me crazy. I just need a way to save the .scss file and have the .css file easily/automatically uploaded to the remote server. Any help would be greatly appreciated!
The typical way Sass is used is to design on your local computer while using Sass, and to only upload the CSS (and probably the Sass as well) to the server once you're finished. Another alternative would be to run sass --watch on the server so that it compiles the uploaded Sass files.
I have had a rake task that calls rsync for this kind of cases. That still needs to be run each time but because it uses rsync only the changed files are moved. Now, while reading this I got an idea that shouldn't there be 'rsync watch' somewhere and indeed there seems to be: http://code.google.com/p/lsyncd/
Here's an interesting approach I just read about, installing compass into a small local ruby env, inspired by python virtualenv:
http://rhodesmill.org/brandon/2011/adding-compass/
YMMV (I haven't even tried this myself).
The Sublime SFTP/FTP Plugin can monitor and auto-upload the .css output file whenever it's updated by the SCSS compiler.
Map your project directory to your server
Check it's woking correctly by browsing remote
Right click on your .css output file, and choose 'Monitor File (Upload on External Save)'
Keep the file's tab open in Sublime to ensure it stays monitored/uploaded.
For extra points, have a look at Browsersync or LiveReload.

Resources