js-tips-tricks | List of JavaScript tips and tricks I am learning everyday | Learning library
kandi X-RAY | js-tips-tricks Summary
kandi X-RAY | js-tips-tricks Summary
List of JavaScript tips and tricks I am learning everyday!
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of js-tips-tricks
js-tips-tricks Key Features
js-tips-tricks Examples and Code Snippets
Community Discussions
Trending Discussions on js-tips-tricks
QUESTION
I don't find, how I can get Python variable, use Grunt.
What I need to learn, that solve this task?
2. DetailsI build site use Pelican and Grunt. I use the same variables:
- In Python format in
pelicanconf.py
for Pelican - In JavaScript format in
Gruntfile.coffee
for Grunt
I want that variables not to be duplicated and contains only in pelicanconf.py
.
Part of pelicanconf.py
:
ANSWER
Answered 2018-Apr-18 at 14:00Directly reading/running Python in JavaScript isn't really something that is easily done.
You could load the Python value as a string and manually parse it. However, I would highly recommend avoid doing this, as it either requires you to have a really simply Python file, or a really complicated string parser.
Instead, I'd recommend picking a format that can easily be read by both. JSON
is always a good choice when dealling with JavaScript and is can be read in natively:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install js-tips-tricks
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page