Coder Social home page Coder Social logo

Comments (4)

knowrama avatar knowrama commented on June 14, 2024 1

Same problem here while dealing with styles. I am using Angular 4.2.5 with Copy Web Pack plugin v 4.0.1.
Can anyone help with resolving this.. Thanks.

from tinymce-angular.

fyrkant avatar fyrkant commented on June 14, 2024

You can't load a sass file into tinymce, so that will never work.

from tinymce-angular.

tjaartvanderWalt avatar tjaartvanderWalt commented on June 14, 2024

I am posting my work-around here if anyone else has the need to compile there .sass files to .css and use it in tinymce

  1. Create a gulp file with a task to compile the .sass file to .css
  2. Add the gulp file to be called when the ng-build or ng-serve command fires
  3. Point the content_css property to the compiled .css file
Here is my gulp file, replace $project_id with your project name

'use strict';
var args = getCommandLineArguments(process.argv);

var gulp = require('gulp');
var sass = require('gulp-sass');

sass.compiler = require('node-sass');

gulp.task('tinymcesass', function () {
    return gulp.src('./src/assets/sass/tinymce.scss')
        .pipe(sass().on('error', sass.logError))
        .pipe(gulp.dest(isProd(args.env) ? './dist/$project_id/assets/' : './src/assets/'));
});

gulp.task('tinymcesass:watch', function () {
    gulp.watch('./src/assets/sass/tinymce.scss', ['tinymcesass']);
});

gulp.task('tinymce', ['tinymcesass']);

// https://www.sitepoint.com/pass-parameters-gulp-tasks/
// fetch command line arguments
function getCommandLineArguments(argList) {

    let arg = {}, a, opt, thisOpt, curOpt;
    for (a = 0; a < argList.length; a++) {

        thisOpt = argList[a].trim();
        opt = thisOpt.replace(/^\-+/, '');

        if (opt === thisOpt) {

            // argument value
            if (curOpt) arg[curOpt] = opt;
            curOpt = null;

        }
        else {

            // argument name
            curOpt = opt;
            arg[curOpt] = true;

        }

    }

    return arg;
}

function isProd(env) { 
    return env === 'prod';
}

Here is my package.json script section:

"prestart": "gulp tinymce --env dev",
"start": "ng serve",
"build": "ng build",   
"postbuild": "gulp tinymce --env prod",

The --env argument is so that the .css file ends up in the correct location for when you are running locally or production

Here is my config object

{
    skin_url: '/assets/plugins/tinymce/skins/lightgray',
    content_css: `/assets/tinymce.css?v=${Date.now()}`,
    height: '480',
    branding: false,                       
}

Date.now() is used for cache busting.

from tinymce-angular.

tjaartvanderWalt avatar tjaartvanderWalt commented on June 14, 2024

Same problem here while dealing with styles. I am using Angular 4.2.5 with Copy Web Pack plugin v 4.0.1.
Can anyone help with resolving this.. Thanks.

Please see my proposed work-around

from tinymce-angular.

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.