HTML5 Boilerplate - Modifying the build.xml for WordPress - regex

I'm trying to get the Build Script that's included in HTML5 BoilerPlate (http://html5boilerplate.com/) to play nicely with WordPress. I've successfully changed the default config to compress style.css in the root of a WordPress theme, but I'm not sure how to modify the build.xml to run through the WordPress header.php and footer.php.
Normally build.xml runs through the index.html file and strips out commenting then, most importantly, changes the version name of the css and js file references.
I'm imagining this should be pretty easy for a developer to figure out, the build.xml uses regular expressions to replace lines of code.
I'd like the build.xml to wizz through my header.php and footer.php, performing the same optimisations as it does with index.html.
Can anyone suggest which parts of the build.xml I need to modify to accomplish this?

you do not need to edit the build.xml file. Just add the files you want parsed to build/config/default.properties :
#
# HTML, PHP, etc files to clean and update script/css references
#
file.pages.default.include = index.html, 404.html, header.php, footer.php

Related

disable prettier plugin for specific directory

In my typescript & svelte project, I use prettier to format codes.
Also, I use prettier-plugin-organize-imports to automatically organize imports.
However, this plugin does not support svelte yet (it kind of works, but it's buggy), so I want to disable the plugin for *.svelte files while enabling it for *.ts files.
According to the official doc of prettier, it seems impossible to do this by adding options to config file (prettier.config.js).
Is there a good way?
You can create a .prettierignore to exclude files from formatting.
# Ignore artifacts:
build
coverage
# Ignore all HTML files:
*.html
Check the docs.

Pycharm Can not find the reference to external javascript and css files

I am not able to locate my external javascript and css files when I ctrl click their path string.
My html template path is 'bodhitree-flipped/concept/templates/concept/content_developer.html'. And my external video.js file path is 'bodhitree-flipped/video/static/video-js/video.js'.
Any Idea how I make pycharm to locate my js files? I know the solution for this is to run python manage.py collectstatic command which will copy all my asset files to /staticfiles folder but I don't want to do it as it will increase the size of my project by duplicating all the static files.
I tried rebuiding the file index with option under File->invalidate caches/Restart... but unfortunately this also doesn't work.
This is how my project structure look like.
click on the file to see code in settings.py
Any help is deeply appreciated.
I have just changed the python template language from jinja to Django (settings->languages and framework->python template languages)and then invalidated the file cache. It worked.

More convention examples

I've been trying to get my head around the Brunch conventions configuration – my lack of comprehension is more than likely due to my lack of experience/knowledge in the world of regex.
It would be great to see an example of how to change the default build location of specific files in the assets/ folder.
A use case
I want to move only the HTML pages to a folder that isn't the public folder. Here's my current folder setup:
app
assets
_inc
header.html
footer.html
...
_layouts
main.html
404.html
...
styles
main.scss
..
node_modules
public
craft
templates
In this case I'd like to move all the HTML files: assets/**/*.html (in glob parlance) to the craft/templates folder.
Any advice, tips, etc would be excellent!
Please & thank you!
In my opinion, you just need to loop through all files in your current folder, use a regex like assets\/.*\/*\.html to search for a match. If match is found, then move to the folder of your choice (i.e, craft/templates).
Here is the regex demo.

Replace text in broccoli-imported css file / ember-cli app

I am currently importing a css file from my bower_components folder in an ember-cli application, e.g.:
app.import('bower_components/toastr/toastr.min.css');
I'd like to modify the CSS in that file before it gets concatenated into vendor.css. How can I do a find a replace so that it ends up in vendor.css?
At this point, I've explored broccoli-replace a bit, but seems that that would only work if I wanted to have toastr.min built as a separate file in my dist folder. I'm not 100% understanding broccoli at the moment, so this could be way off.

How to package an OpenStack Horizon Dashboard plugin correctly?

I am packaging a Horizon Plugin. I have a bunch of templates, a view, as well as css, js files, and images.
Everything should be contained so that the package is either a .deb or a tarball. So right now I keep all files in /opt/stack/horizon/openstack_dashboard/dashboards/<my-dashboard-name>.
My question is, how do I include js and css files properly? There is /opt/stack/horizon/openstack_dashboard/settings.py file that specifies HORIZON_CONFIG.js_files, however it is always empty! I put a list of files there, it still comes out as empty in the templates. So the question is, how do I include js and css files in a Horizon dashboard plugin, for the purpose of packaging it in either a single tarball or a .deb package?
You should store static files below <my-dashboard-name>/static. It's best to namespace your static files, I use the following directory structure:
<my-dashboard-name>/static/<my-dashboard-name>/js and so on for css and img then I reference the files in the HTML templates with /static/<my-dashboard-name>/js/jsfile.js, that way you won't get any name collisions.
When someone uses your plugin they extract your dashboard and register it in the right places and then additionally they have to run the collectstatic django management command from the base openstack_dashboard directory (in your case /opt/stack/horizon/), either:
$ ./run_tests.sh -m collectstatic
or
$ ./manage.py collectstatic
That should copy your static files to the right places according to how the site has been configured.