Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
2cc62bff
Commit
2cc62bff
authored
Nov 14, 2015
by
Immortalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaned up merge
parent
8977ebf4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
51 deletions
+0
-51
.gitignore
.gitignore
+0
-1
app.headless.js
app.headless.js
+0
-29
input.xml
input.xml
+0
-5
readme.headless.md
readme.headless.md
+0
-16
No files found.
.gitignore
View file @
2cc62bff
...
@@ -5,4 +5,3 @@ npm-debug.log
...
@@ -5,4 +5,3 @@ npm-debug.log
.project
.project
*.pyc
*.pyc
*.komodoproject
*.komodoproject
node_modules
\ No newline at end of file
app.headless.js
deleted
100644 → 0
View file @
8977ebf4
// This program is to be used with NodeJS run Blockly headless. It loads
// Blockly XML from `input.xml` and outputs python code on `stdout`.
global
.
DOMParser
=
require
(
'
xmldom
'
).
DOMParser
;
global
.
Blockly
=
require
(
'
./blockly_uncompressed.js
'
);
require
(
'
./blocks_compressed.js
'
);
require
(
'
./python_compressed.js
'
);
var
fs
=
require
(
'
fs
'
);
//the contents of './input.xml' are passed as the `data` parameter
fs
.
readFile
(
'
./input.xml
'
,
function
(
err
,
data
)
{
if
(
err
)
throw
err
;
var
xmlText
=
data
.
toString
();
//convert the data buffer to a string
try
{
var
xml
=
Blockly
.
Xml
.
textToDom
(
xmlText
);
}
catch
(
e
)
{
console
.
log
(
e
);
return
;
}
// Create a headless workspace.
var
workspace
=
new
Blockly
.
Workspace
();
Blockly
.
Xml
.
domToWorkspace
(
workspace
,
xml
);
var
code
=
Blockly
.
Python
.
workspaceToCode
(
workspace
);
console
.
log
(
code
);
});
\ No newline at end of file
input.xml
deleted
100644 → 0
View file @
8977ebf4
<xml
xmlns=
"http://www.w3.org/1999/xhtml"
>
<block
type=
"colour_picker"
id=
"11"
x=
"93"
y=
"12"
>
<field
name=
"COLOUR"
>
#ff0000
</field>
</block>
</xml>
\ No newline at end of file
readme.headless.md
deleted
100644 → 0
View file @
8977ebf4
# Blockly Headless
Running Blockly headless is valuable to allow for server side code generation.
The NodeJS program
`app.headless.js`
loads Blockly XML from
`input.xml`
and outputs python code on
`stdout`
.
### Prerequisites
Be sure to have these installed on your system:
-
NodeJS -- http://nodejs.org/
-
NPM -- (Bundled with NodeJS)
-
closure-library -- http://developers.google.com/blockly/hacking/closure
## Getting Started
1.
run
`npm install`
in the blockly root directory(in the same location as the package.json).
2.
run
`./build.py`
to update the compressed files, as
`build.py`
**has changed**
.
3.
run
`node app.headless.js`
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment