Package Exports
- bluscript
- bluscript/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bluscript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
BluScript
Version: 1.0.1
A lightweight Domain-Specific Language (DSL) for generating web components.
Installation
npm install bluscriptQuick Start
import { Parser, HTMLGenerator } from 'bluscript';
const code = `
LOGIN PAGE {
FIELD: username
FIELD: password
AUTH: JWT
ACTION: /login
}
`;
const parser = new Parser(code);
const ast = parser.parse();
const htmlGenerator = new HTMLGenerator();
ast.forEach(command => {
if (command.type === 'LOGIN') {
const html = htmlGenerator.generateLoginPage(command);
console.log(html);
}
});Syntax
LOGIN PAGE
Creates a login form with specified fields and configuration.
LOGIN PAGE {
FIELD: username
FIELD: password
AUTH: JWT
ACTION: /login
}Parameters:
FIELD: Input field (can be specified multiple times)AUTH: Authentication methodACTION: Form submission endpoint
Generated HTML example:
<form action="/login" method="POST">
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" required>
</div>
<button type="submit">Login</button>
</form>API Reference
Parser
const parser = new Parser(code);
const ast = parser.parse();HTMLGenerator
const generator = new HTMLGenerator();
const html = generator.generateLoginPage(command);Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT License - see the LICENSE file for details