Giter Club home page Giter Club logo

Comments (4)

greut avatar greut commented on July 17, 2024 5

@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.

jedfoster avatar jedfoster commented on July 17, 2024

@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.

chrisgeo avatar chrisgeo commented on July 17, 2024

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.

thlorenz avatar thlorenz commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.