JSPM - System - text plugin, remove whitespace - jspm

When I use the text plugin of JSPM - System JS - like in the following code:
import dashboardTpl from './dashboard.tpl.html!text';
I get a string similar to this:
'<div class="bug" ng-class="{\r\n \'closed-bug\' : bugCtrl.statusCode == 90,\r\n \'sev-one\':'
Is there an option for the plugin to remove white-space?

This is not possible by means of the text plugin (see source https://github.com/systemjs/plugin-text/blob/master/text.js). There are two options here:
create your own text plugin which additionally removes whitespace
remove whitespace in js after you import the text

Related

How to Configure Multiple Plugins in Mypy?

I want to use both the numpy and the pydantic plugins for mypy, I tried the following in the mypy.ini:
[mypy]
plugins = [ numpy.typing.mypy_plugin, pydantic.mypy ]
# ...
It needs to be configured as comma-separated string instead of an actual list, see the docs. This works:
[mypy]
plugins = numpy.typing.mypy_plugin, pydantic.mypy
# ...

Linux pipe to text file shows unwanted special characters in text editor

my
symfony help >> ./symfonyBinConsole2copyQ.sh;
looks encrypted for me.
result looks in Kate editor like so:
[32mSymfony CLI[39m version [33mv4.25.4[39m (c) 2017-2021 Symfony SAS
...
expected the same formation like i know it from terminal:
Symfony CLI version v4.25.4 (c) 2017-2021 Symfony SAS
...
source i readet:
-https://stackoverflow.com/questions/41428967/linux-pipe-mysql-cli-show-variables-to-text-file
Pitest: How to redirect the log output to a file?
Various console apps either default to showing with Ansi terminal codes, or without. The Symfony console command has a --no-ansi option to turn it off.
An issue at https://github.com/symfony/cli/issues/222 also suggested the env var NO_COLOR, which does also work.
NO_COLOR=1 symfony list

parsing SVG in webpack

I have created a project on Symfony 5. I am receiving an error in webpack when I run 'yarn build'. I am trying to fix it from few days but without success, so I decided to ask for some help :)
This is the error I am getting:
I have enabled postCssLoader in my webpack.config and created postss.config.js in my root directory
.enablePostCssLoader()
postss.config.js File
module.exports = {
plugins: [
require('autoprefixer'),
require('postcss-svgo'),
require('postcss-inline-svg'),
require('postcss-write-svg'),
]
}
And here is a sample of svg I am trying to write in my css
.custom-checkbox .custom-control-input:checked~.custom-control-label::after {
background-image: url('data:image/svg+xml,%3csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'8\'
height=\'8\' viewBox=\'0 0 8 8\'%3e%3cpath fill=\'%23fff\' d=\'M6.564.75l-3.59 3.612-1.538-
1.55L0 4.26l2.974 2.99L8 2.193z\'/%3e%3c/svg%3e')
}
If the error transfers code verbatim, then there are two line breaks (and indentation) that makes the property invalid (see "CRLF": ..width=\'8\'CRLF height.. - this one you can backslash-escape in CSS, and ..1.538-CRLF 1.55L.. - this one with indentation separates numeral making path data invalid - you have to remove all whitespace between minus and digit). If this is it, simply removing line breaks (and suprefluous whitespace) should fix it:
background-image: url('data:image/svg+xml,%3csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'8\' height=\'8\' viewBox=\'0 0 8 8\'%3e%3cpath fill=\'%23fff\' d=\'M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z\'/%3e%3c/svg%3e')
If code snippet you provided is not directly from your source code, then you have probably some formarrter breaking it in the process (?)
N.B. you don't usually have to escape SVG datauris so much, you could go with url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8' fill='%23fff'><path d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/></svg>") (i.e. the only escaped sequence is #->%23) and most interpreters should pick it up just fine. I'm not sure about your build stack, but I'd guess that "safe over-escaped format for obsolete IEs" could be produced as the build result; and if you use preprocessor you can embed 'dataurized' external resources, what could prevent such formatting accidents. (Ah, that's probably what the postcss-inline-svg is doing for you.)

OmniMarkupPreviewer 404

(English is not my native language)
Hello, I established OmniMarkupPreviewer. I open my page with Mediawiki markup and I press Ctrl + Alt + o to see it in my browser. But the mistake opened:
Error: 404 Not Found
Sorry, the requested URL 'http://127.0.0.1:51004/view/31' caused an error:
'buffer_id(31) is not valid (closed or unsupported file format)'
**NOTE:** If you run multiple instances of Sublime Text, you may want to adjust
the `server_port` option in order to get this plugin work again.
I tried to change «Settings - User» as advised here:
{
"server_host": "0.0.0.0",
"server_port": 9998
}
But the new mistake turned out:
Sorry, the requested URL 'http://127.0.0.1:9998/view/52' caused an error:
'buffer_id(52) is not valid (closed or unsupported file format)'
**NOTE:** If you run multiple instances of Sublime Text, you may want to adjust
the `server_port` option in order to get this plugin work again.
What I need to make for the correct work of OmniMarkupPreviewer?
there are two solutions in here by #scuml, i solved this problem by first solution: [Remove Strikethrough Extension]
Here is the answer:
Sublime Text > Preferences > Package Settings > OmniMarkupPreviewer > Settings - User
paste the following to remove the strikeout package.
{
"renderer_options-MarkdownRenderer": {
"extensions": ["tables", "fenced_code", "codehilite"]
}
}

Grunt: How to change config strings for different environments

I have a python file as part of my grunt workflow. I have defined two build tasks:
build:dev
build:release
When I compile 'build:dev', I want to add this line to my python file:
...
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + dbpath
...
When I compile 'build:release', I want to add this line to my python file:
...
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['POSTGRESQL_COLORFUL_URL']
...
edit: fixed typo in code and title
You can use grunt-sed.
It's a really useful 'find and replace' system that builds into Grunt.
From the docs:
npm install grunt-sed
Add this line to your project's Gruntfile.js:
grunt.loadNpmTasks('grunt-sed');
Then in your build:dev and build:release tasks have the following:
sed: {
database_uri: {
path: 'path_to_your_python.py',
pattern: '%PATTERN_IN_YOUR_PYTHON_FILE%',
replacement: '\'sqlite:///\' + dbpath',
}
}
In your python file you want replacing you must also have %PATTERN_IN_YOUR_PYTHON_FILE% to be replaced.
I've used a plugin called grunt-string-replace that worked very well for what I needed to do. Also, I added some custom code in my Gruntfile.js to read different environment configurations and customize the build output based on that.
I detailed the full deployment script in this post: http://dev-blog.cloud-spinners.com/2014/02/complete-grunt-deployment-workflow-for.html
I hope you find that useful.

Resources