How to disable certain Nuxt 3 pages? - nuxtjs3

Sometimes you have unfinished pages you don't want to make publicly available yet but you still want to publish the rest of your work.
You can either strictly work with feature branches, or you rename your page file ending into something like .txt, or you move them out of the pages directory.
Is it somehow possible to disable certain pages of your Nuxt 3 app?

Have you tried using the .nuxtignore file?
# ignore layout foo.vue
layouts/foo.vue
# ignore layout files whose name ends with -ignore.vue
layouts/*-ignore.vue
# ignore page bar.vue
pages/bar.vue
# ignore page inside ignore folder
pages/ignore/*.vue
# ignore route middleware files under foo folder except foo/bar.js
middleware/foo/*.js
!middleware/foo/bar.js
https://nuxt.com/docs/guide/directory-structure/nuxtignore#nuxt-ignore-file
This seems to fit what you're trying to achieve.

Related

Concrete5: Why single pages do not automatically get the active theme applied to them?

I am working on 5.6.3.4. Just curious to learn why the single pages do not automatically get the active theme applied to them. It looks like I have to manually map the single pages to a theme inside the /config/site_theme_paths.php file or am I missing something? So everytime I create a new site I have to do the mapping for all single pages in /config/site_theme_paths.php. Not sure how it's done in 5.7 but that's a bit of a pain.
The only Single Pages you have to map with the /config/site_theme_paths.php are the System single pages (Login/Register/etc) the rest will use the view.php in your theme as the wrapper automatically. This is the same with 5.7 I believe.

Coding with Sublime Text - having trouble with filepath's in css

So I code in Sublime Text 2 combining HTML, CSS, and jQuery to make web designs.
For some reason, when I am trying to specify a location of a file, say Pic01.jpg in the folder images, you would suspect typing in /images/Pic01.jpg should be enough to tell the browser where the picture is located.
But this is not the case. I find myself needing to specify the exact location of the file before the browser will render it. Like; User/Desktop/siteOne/images/Pic01.jpg
This path system is very inconvenient, as I would like to say - export my sites to different computers, but now the code is bound to that specific location on that specific computer.
How can I set it up to make /images/Pic01.jpg sufficient coding for the browser (or Sublime?) to understand what needs to be rendered?
Prepending the path by / means that it will start it search at the root, which can change depending on your server configuration.
With WAMP/MAMP, I have to prepend my URLs by / and then the name of the folder they are in, if they are not at the absolute root of the server. It depends on your setup.
If you want paths that will work regardless of the server root, it's best to use a relative path or use a constant that can easily be changed depending on the configuration.
Example :
define("PATH", "/");
Link that always work
You will only have one line to change to make your paths work all the time with a different configuration - relative paths can be tricky to deal with when working in deep sub-folders.
Furthermore, if you want to see where it's actually looking for the file, open the Console in your web browser of choice, they should display the error (404 most likely) and the path it's looking at.

I want a completely separate page from my Wordpress-installation

I have a wordpress-driven project and want to add 1 single page to that project, that has entirely nothing to do with wordpress at all, but just consists of plain html - no links from the one to the other; nothing. This page shall be accessible via abc.com/folder while the original wordpress-project is still all over abc.com
What would be the best way to do this? Just add the folder and page, or do I also need to do something on the htaccess-file?
thanks
Just create that folder and name your html index.html inside that folder. This way that html file can be accessed via abc.com/folder

Drupal - customizing $scripts output

Basically the issue im having is I have a custom theme, and I need to use $scripts to call the analytics code at the top (the link tracking settings) however this also loads loads of other cr*p js files I dont need or want.
All I want is the analytics stuff the module places in $scripts.
So can I somehow either:
A) Load only the analytics code via $scripts (.info file?)
B) Create a new region in .info file (e.g. $analytics) and call that via the template. But then how do I get the analytics code to output to this new region instead of $scripts?
Any help would be most appreciated.
A.
I would be wary of not outputting $scripts. The files that are output are needed for your other modules to work properly. If you want to reduce the scripts which are output then turn off modules that you don't need.
I agree that disabling the $scripts variable (or cleaning it out) will have some "undesired results". I can think of about half a dozen modules that I use on every build that have required js files.
Maybe you should look into the Google Analytic Module which uses the $footer variable instead of the $scripts.
http://drupal.org/project/google_analytics
I also use this module on all my builds as it provides some very easy integration of Drupal into GA including downloads, user roles, etc. (out of the box)
p.s.
Remember Drupal has a pretty good Performance settings that allow for the cache as well as consolidation css/js.
My final builds have 1 line of markup that calls ALL of my css for that page and one line that does the same for my js. It's been shown that consolidating your asset files into one large file rather then many small ones is a huge performance saver, more so then the size of the end file itself.

How to create custom CSS "on the fly" based on account settings in a Django site?

So I'm writing a Django based website that allows users select a color scheme through an administration interface.
I already have middleware/context processors that links the current request (based on domain) to the account.
My question is how to dynamically serve the CSS with the account's custom color scheme.
I see two options:
Add a CSS block to the base template that overrides the styles w/variables passed in through a context processors.
Use a custom URL (e.g. "/static/dynamic/css/< website_id >/styles.css") that gets routed to a view that grabs all the necessary values and creates the css file.
I'm content with either option, but was wondering if anyone else out there has dealt with similar problems and could give some insight as to "Best Practices".
Update : I'm leaning towards option number 2, as I think this will allow for better caching down the road. So it's dynamic the first time, gets stored in memcache (or whatever), and invalidated when a user updates their settings in the admin site.
Update: Firstly, I'd like to thank everyone for their suggestions thus far. All the answers thus far have focused around generating static files. Though this would work great in production, it feels like a tremendous burden during development. If I wanted to add a new element to be styled, or tweak existing styles I'd have to go through and recreate each and every css file. Sure, this could be done with a management command, but I just don't feel it's worth it. Doing it dynamically would add 1 maybe 2 queries to each page load, which is something I'm not worried about at this stage. All I need to know is that at some point I will be able to cache it without rewriting the whole thing.
I've used option #2 with success. There are 2 decent ways of updating the generated static files that I know of:
Use a version querystring like /special_path.css?v=11452354234 where the v parameter is generated from a database field, key in memcached, or some other persistent file. Version gets updated by admin, or for development you would just make the generation not save if the parameter was something special like v=-1. You'll need a process to clean up the old generations after some time.
Don't use a version querystring, but have it look first for the generated file, if it can't find it, it generates it. You can create a cron job or WSGI app that looks for filesystem changes for development, and have a hook from your admin panel that deletes generations after an update. Here's an example of the monitoring, which you would have to convert to be specific to your generations and not to Django. http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode#Monitoring%5FFor%5FCode%5FChanges
Could generate the css and store it in a textfield in the same model as the user profile/settings. Could then have a view to recreate them if you change a style. Then do your option 1 above.
Nice question.
I would suggest to pre-generate css file after colors scheme is saved. This would have positive impact on caching and overall page loading time. You can store your css files in directory /media/css/custom/<id or stometing>/styles.css or /media/css/custom/<id or sth>.css and in template add <link rel="stylesheet" href="/media/css/custom/{{some_var_pointing _to_file_name}}" />
You can also do the trick with some random number or date in css file name that could be changed each time file is saved. Thanks to this browser will load the file immediately in case of changes.
UPDATE: example of using model to improve this example
To make managing of those file easy you can create simple model (one per user):
class UserCSS(models.Model):
bg_color = models.CharField(..)
...
...
Fields (like bg_color) can represent parts of your css file. You can ovveride save method to add logic that creates css file for user (by rendering some template).
In case your file format change you can make changes in your's model definition (with some default values for new fields), make little changes in template and run save method for each exisintg instance of class. This would renew your css files.
That should work nicely.
I would create an md5 key with the theme elements, store this key in the user profile and create a ccs file named after this md5 key : you gain static file access and automatic theme change detection.

Resources