Comments (4)
@soulmachine nothing special. This file is compiled with babel like any other file.
import ace from 'brace'
import 'brace/ext/statusbar'
import 'brace/ext/language_tools'
import 'tind/mode/xml'
import 'brace/theme/monokai'
const editor = ace.edit('marc-editor'),
const StatusBar = ace.acequire('ace/ext/statusbar').StatusBar
editor.statusbar = new StatusBar(editor, document.getElementById("status-bar"))
editor.getSession().setMode('ace/mode/xml')
editor.setTheme('ace/theme/xml')
//...
from brace.
@soulmachine I recently converted a project that uses brace from Browserify to Webpack and other than configuring Webpack with my entries and outputs, I made no changes to application code. Brace doesn't care whether you use Browserify or Webpack. Is there a specific point that you are stuck on?
I use Webpack via Gulp, which results in a slightly more complex solution, but I have my reasons; some of this might not apply to your set up...
// gulp/config.js
module.exports = {
webpack: {
entry: {
app: src + '/js/app.coffee',
editor: src + '/js/editor.coffee'
},
output: {
path: __dirname + '/../public/js/',
filename: '[name].js'
},
devtool: 'source-map',
module: {
loaders: [
{ test: /\.jade$/, loader: "jade-html" },
{ test: /\.coffee$/, loader: "coffee" }
]
}
},
}
// gulp/tasks/webpack.js
var gulp = require('gulp');
var config = require('../config');
var webpack = require('webpack-stream');
var named = require('vinyl-named');
var entries = Object.keys(config.webpack.entry).map(function (key) {return config.webpack.entry[key]});
gulp.task('webpack', function(callback) {
return gulp.src(entries)
.pipe(named())
.pipe(webpack(config.webpack))
.pipe(gulp.dest(config.webpack.output.path));
});
# client/js/editor.coffee
require 'brace'
# require 'brace/mode/css'
# require 'brace/mode/sass'
# require 'brace/mode/scss'
# require 'brace/mode/html'
# require 'brace/mode/haml'
# require 'brace/mode/jade'
require 'brace/mode/markdown'
# require 'brace/mode/textile'
# require 'brace/ext/emmet'
# require 'brace/keybinding/vim'
require 'brace/theme/tomorrow'
require "./edit"
# ... more app-specific `require`s
If I were using Webpack directly on the CLI, then all I'd need is the configuration block, with some modifications.
Hope that helps.
from brace.
One thing I've noticed, and hopefully I'm not hijacking this issue is: how can I compile the worker into the file do it doesn't load it asynchronously:
define([
'brace',
'brace/mode/css',
'brace/theme/monokai',
'brace/worker/css'
], function () {});
When running webpack it still loads the file on demand for some reason.
from brace.
Not made for webpack, but for browserify.
If you figure out how to do it anyways please provide a PR to add that information to the Readme.
Thanks.
from brace.
Related Issues (20)
- ace.edit can't find div #javascript-editor inside Angular Material elements
- Lua mode doesn't support the Lua 5.3 floor-division operator '//' HOT 1
- Typo in searchbox.js
- Upgrade ace editor version to latest HOT 7
- Add support to Firefox nunjucks
- Wrong cursur width when typing Asian Characters under Vim Mode HOT 1
- Support for flatbuffers mode
- About AutoCompletion
- Mismatched / incorrect types
- setValue method is emitting the change event twice HOT 2
- Could brace format js code?
- The getname() method cannot get the result of the error prompt in time HOT 1
- Get errors list or invalid state
- How to get Range from Brace and TypeScript? HOT 1
- Hi,how to show line number? HOT 1
- Accessibility: Add role=log attribute to autocomplete popup. #1777
- Question/Accessibility: what is the keyboard combo to get out of of the focus trap?
- Keyboard trap is observed between tool bar section and code block under "Module Twin" tab. HOT 3
- seems not working for chrome mv3 extensions.
- editor: assigning value during initialization of editor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brace.